Debug/Serout/Serout2 - please, need advice ...


Results 1 to 14 of 14

Threaded View

  1. #1
    Join Date
    Dec 2008
    Location
    Ploiesti, ROMANIA
    Posts
    582

    Default Debug/Serout/Serout2 - please, need advice ...

    Hi !
    I try to understand how work communication between PIC and PC.
    I wrote this simple code :
    Code:
    @ __config _INTRC_OSC_NOCLKOUT & _WDT_ON & _PWRTE_ON & _MCLRE_OFF & _BODEN_ON 
     
    INCLUDE "modedefs.bas"       
    DEFINE OSC 04                 
            CMCON = 7               
            VRCON = 0               
            WPU = 0                 'no wake pullup
            IOCB = 0                'no int. on change
            ANSEL = %01010001       
            ADCON0 = %10000001      'right just , Vref=Vdd , ch.0 , A/D on
            GPIO = %00101001        'preset I/O
            TRISIO = %00001001      'configure direction  1=input 0=output
            OPTION_REG = %10000111
    
    advalue        var     word
    
    Main:
    PauseUs 50                  'sample time
            ADCON0.1 = 1                'start A/D
            @ nop
            while ADCON0.1 = 1          
            wend
            advalue.byte1 = ADRESH         'get A/D value
            advalue.byte0 = ADRESL
    
            if advalue < 650 then
               SerOut2 GPIO.5,300,["Advalue : ",DEC advalue, 13, 10]   ; the calculated result is "93" , but ?!
            endif
    goto Main
    I use on GPIO.0 one 1k resistor to +5 volts and one 100R resistor to ground. Advalue is 93, don't ?!

    But on RealTerm I am unable to see the "real" value of Advalue, no matter what option I choose...
    What I do wrong ?!
    Thanks in advance !
    Attached Images Attached Images  

Similar Threads

  1. 12f629 serout,debug and serout2 timings
    By Dennis in forum mel PIC BASIC Pro
    Replies: 0
    Last Post: - 10th January 2010, 03:13
  2. Serout/serin issues, advice required
    By Agent36 in forum mel PIC BASIC Pro
    Replies: 9
    Last Post: - 29th May 2008, 22:51
  3. debug vs serout vs serout2
    By mychangl in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 25th March 2007, 05:35
  4. Serout/serout2
    By fowardbias in forum Serial
    Replies: 10
    Last Post: - 23rd January 2006, 05:48
  5. Debug vs SerOut Commands
    By EShatara in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 29th November 2004, 05:16

Members who have read this thread : 2

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