Really simple test program not working.


Results 1 to 3 of 3

Threaded View

  1. #1
    Join Date
    Feb 2004
    Location
    Michigan, USA
    Posts
    305

    Default Really simple test program not working.

    18F2550 20mhz HSPLL set up for USB

    PIC functions and pcb is fine. I can get a simple blinky light to work. I can get a correct ADC value to write to EEPROM and read through the programmer, but I cant get it compare the ADC value with the value stored in fb and turn on or off the LED as I vary the voltage in the ACD pin.

    What the heck am I missing?

    Code:
    define OSC 48
    DEFINE ADC_BITS 10
    DEFINE ADC_CLOCK 3
    DEFINE ADC_SAMPLEUS 50
    raw var word
    raw1 var word
    fb var word
    fb = 205
    ADCON1 = 001011
    ADCON2 = 000011
    
    
    TRISA = 001111
    TRISB = 110000
    TRISC = 000000
    PORTC.2 = 0
    
    
    main:
    pause 100
    adcin 0, raw
    raw1 = raw/10
    if raw1 => fb then
    Portc.0 = 1
    else 
    portc.0 = 0
    endif
    
    
    goto main]
    Last edited by mackrackit; - 24th October 2011 at 18:19. Reason: fix code tag

Members who have read this thread : 0

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts