RS232 serial commands


Results 1 to 16 of 16

Threaded View

  1. #5


    Did you find this post helpful? Yes | No

    Default Re: RS232 serial commands

    Quote Originally Posted by mister_e View Post
    try something like that
    Code:
            DEFINE OSC 40      
            DEFINE HSER_RCSTA 90h 
            DEFINE HSER_TXSTA 20h 
            DEFINE HSER_BAUD 9600
            DEFINE HSER_SPBRG 64
        
    Start:        
            Hserout ["Program has started.",13,10] 
            gosub LookForStart
            Goto Start
    
    LookForStart:
            HSERIN 5000,noData,[WAIT ("start")] 
            hserout ["Got it! Backlight ON",13,10]
            Return
     
    nodata:
            HSEROUT ["NOPE... Life's so cruel...",13,10]
            Return
    Thanks!

    HSERIN command remind me the BUTTON command (with the label).

    So I use this :

    Code:
    DEFINE OSC 40      
    DEFINE LCD_DREG PORTD
    DEFINE LCD_EREG PORTB
    DEFINE LCD_RSREG PORTB
    DEFINE LCD_EBIT 6
    DEFINE LCD_RSBIT 7
    DEFINE ADC_BITS 10
    DEFINE HSER_RCSTA 90h 
    DEFINE HSER_TXSTA 20h 
    DEFINE HSER_BAUD 9600
    DEFINE HSER_SPBRG 64
    
    Hserout ["Varidrive V2011.00 has started"] 
     
    mainlp:        
          
    LCDOUT $fe,2,"Main loop"
            
    HSERIN ret,[WAIT ("blon")] 
           HIGH PORTD.4
    ret:
    
    HSERIN ret1,[WAIT ("bloff")] 
           LOW PORTD.4
    ret1:
    
    Goto mainlp
    And it works flawlessly.

    However, when I type "blonn" instead of "blon", the backlight is activated.
    Same thing with "blofffff" instead off "bloff", the backlight is disabled.

    So I need a stop bit or something like that?
    Last edited by pxidr84; - 22nd August 2011 at 21:13.

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