Menu

XMIT_PRINT

Help
2008-07-02
2013-05-30
  • Nobody/Anonymous

    Will this send "test" to hyperterminal

    #chip 12F675, 4 'mhz 
    #config OSC=INTOSC, MCLRE=off, WDT=off 

    Ser_Init 

    start: 

    XMIT_PRINT(test) 

    wait 5 sec 
    goto start 

    Sub Ser_Init 
    #define baud 417 ;the us delay for 2400 baud rate 
    #define SerTxHigh Set GPIO.1 off 
    #define SerTxLow Set GPIO.1 On 
    dir GPIO.1 out 
    dir GPIO.0 in 
    SerTxHigh ;Initial RS232 idle state 
    end sub 

    sub XMIT_PRINT (PrintData$) 
    PrintLen = PrintData(0) 
    if PrintLen = 0 then exit sub 
    'Write Data 
    for SysPrintTemp = 1 to PrintLen 
    XMIT_RS232(PrintData(SysPrintTemp)) 
    next 
    end sub 

    Sub XMIT_RS232(Xmit_Byte)#NR 
    SerTxLow ;Start bit 
    wait baud us 
    For cntr = 1 to 8 
    Rotate Xmit_Byte Right 
    If Status.C ON Then SerTxHigh 
    If Status.C Off Then SerTxLow 
    wait baud us 
    Next 
    SerTxHigh ;Stop bit 
    wait baud us 
    end sub 

     
    • kent_twt4

      kent_twt4 - 2008-07-03

      Use the quotes for strings, XMIT_PRINT("test").

      For some forgotten reason, do not invert SerTxHigh and SerTxLow.  Use:
      #define SerTxHigh Set GPIO.1 on 
      #define SerTxLow Set GPIO.1 Off  

       

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.