Need help with programming PICs with analogue input

Discussion in 'Embedded Systems and Microcontrollers' started by Hliu, Nov 24, 2008.

  1. Hliu

    Thread Starter New Member

    Nov 4, 2008
    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

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

    low 5
    low 4
    low 3
    low 2
    goto label0

    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.
  2. beenthere

    Retired Moderator

    Apr 20, 2004
    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".
  3. AlexR

    Well-Known Member

    Jan 16, 2008
    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.
  4. Hliu

    Thread Starter New Member

    Nov 4, 2008
    Crocodile Technology is a software that simulates circuits, flow charts and PCBs. Their site is here:

    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