Need help with programming PICs with analogue input

Thread Starter

Hliu

Joined Nov 4, 2008
3
Hi, I'm having trouble programming Pics with analogue inputs, specifically the PIC16F627 and the PIC16F628

I built a flowchart to read and compare two analogue signals in Crocodile Tech and it simulates fine, however when I try to transfer it to any of the chips mentioned an ''Readadc' command not supported in this mode' error appears.

My flowchart in basic is:

symbol x = b0
symbol y = b1
main:

label0:
readADC 0,x
readADC 1,y
if x >= y then label1
gosub CCW

label2:
low 5
low 4
low 3
low 2
goto label0

label1:
if x = y then label2
gosub CW
goto label2

Both of the PICs are definitely supported by crocodile tech, but it just wouldn't allow me to have 'ReadADC' in my program. I'm probably missing something quite obvious here, but I'm really stumped.

Any help is appreciated.
 

beenthere

Joined Apr 20, 2004
15,819
Searching "crocodile tech" doesn't bring up anything obvious. If, as it sounds, the app is a simulator or virtual PIC, then it may not feature a compiler that translates its instructions into a format that the PIC can use.

Tells us more about "crocodile tech".
 

AlexR

Joined Jan 16, 2008
732
If you read the PIC data sheet you will find that the PIC16F627/628 chips don't have any ADC converters so obviously the "Readadc" is somewhat meaningless.
 

Thread Starter

Hliu

Joined Nov 4, 2008
3
Tells us more about "crocodile tech".
Crocodile Technology is a software that simulates circuits, flow charts and PCBs. Their site is here: http://www.crocodile-clips.com/en/Design_and_Technology/

If you read the PIC data sheet you will find that the PIC16F627/628 chips don't have any ADC converters so obviously the "Readadc" is somewhat meaningless.
Yeah that's what confuses me, because in my flow chart the command is simply 'Read x <-- Input1', which defines the variable x as whatever the voltage level is at Input1, so if it does require ADC modules in the PIC then it shouldn't be working in the software, but it simulates fine, which leads me to think its not that I chose an inappropriate chip
 
Top