I have a Pic16f684 a 14 pin pic
1 MHz speed
I'm wanting 2 analog inputs
the rest led drivers
and timer 0
I want to use the interprat for the A/D for stablity
But I can not complile
why not>
I have my code on the great cow basic directroy and its fownd the *.dat file ok
my code so far
#chip 16F684, 1
#Config NOT_RAPU = off, TOCS = off, PSA = off, PS2 = on, PS1 = on, PS0 = on
//#ADCON0 ADON = ON // = START ADC
#ADCON0 = '00000001'
#ADCON1 = '00000000' // = FOSC 2 SET FROM INTERNIL OSC
#ANSEL = '00000011' // SET PIN 12-13 TO ANALOG IN
main
Goto Main
Lex Dean
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
How about starting with a simple blinky led program first, then expand from there. There are many good example programs offered in the HELP file, found either on the GCBasic web page, or in the GCBasic folder. Doing a few examples will help you get accustomed to the required GCBasic syntax.
While you can easily set individual PIC internal registers, it is not often required. For instance, instead of writing the TrisX register, use the dir PortX.x out/in command.
Also, unless there is a special reason, setting the internal oscillator to a higher setting like 4Mhz (or better yet, 8Mhz and up if available). Some program libraries are just not going to run well, if at all with a slow clock.
Try the blinky led, a-d, timer, and interrupts individually first. Then add them together, It will be much easier to debug your program that way.
#chip 16f684, 8
#config INTRC_OSC
#define LED1 PortC.0
#define LED2 PortC.1
dir LED1 out
dir LED2 out
Main:
SET LED1 ON
SET LED2 OFF
WAIT 50 10ms
SET LED1 OFF
SET LED2 ON
WAIT 50 10ms
goto Main
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I have a Pic16f684 a 14 pin pic
1 MHz speed
I'm wanting 2 analog inputs
the rest led drivers
and timer 0
I want to use the interprat for the A/D for stablity
But I can not complile
why not>
I have my code on the great cow basic directroy and its fownd the *.dat file ok
my code so far
#chip 16F684, 1
#Config NOT_RAPU = off, TOCS = off, PSA = off, PS2 = on, PS1 = on, PS0 = on
#OPTION '11010011' //T0SE = 0N, PSA = OFF, PRESCALER 1/16TH
#INTCON = '00100000' // sets up timer 0 overflow
#PIE1 = '01000000'
#PIR1 = '01000000'
#PCON = '00110000'
#osccon = '01000101' // = 1 MEG INTERNIL OSC
//IRCF0 = 4, OSTS = 0ff, HTS = on, LTS = off, SCS = on
#TRISA = '00110100'
#IOCA = '00000000'
#TRISC = '11111111'
//#ADCON0 ADON = ON // = START ADC
#ADCON0 = '00000001'
#ADCON1 = '00000000' // = FOSC 2 SET FROM INTERNIL OSC
#ANSEL = '00000011' // SET PIN 12-13 TO ANALOG IN
main
Goto Main
Lex Dean
How about starting with a simple blinky led program first, then expand from there. There are many good example programs offered in the HELP file, found either on the GCBasic web page, or in the GCBasic folder. Doing a few examples will help you get accustomed to the required GCBasic syntax.
While you can easily set individual PIC internal registers, it is not often required. For instance, instead of writing the TrisX register, use the dir PortX.x out/in command.
Also, unless there is a special reason, setting the internal oscillator to a higher setting like 4Mhz (or better yet, 8Mhz and up if available). Some program libraries are just not going to run well, if at all with a slow clock.
Try the blinky led, a-d, timer, and interrupts individually first. Then add them together, It will be much easier to debug your program that way.
#chip 16f684, 8
#config INTRC_OSC
#define LED1 PortC.0
#define LED2 PortC.1
dir LED1 out
dir LED2 out
Main:
SET LED1 ON
SET LED2 OFF
WAIT 50 10ms
SET LED1 OFF
SET LED2 ON
WAIT 50 10ms
goto Main
I need to ran to use the complier!!!!!!!!!!!
The complier is vague in error messages and many programs seen half complete.
I have questions over selecting the correct chip
And understanding the error messages.