RS232 serial commands


Closed Thread
Results 1 to 16 of 16

Hybrid View

  1. #1
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default Re: RS232 serial commands

    Another Variant...
    Code:
            DEFINE OSC 40      
            DEFINE HSER_RCSTA 90h 
            DEFINE HSER_TXSTA 20h 
            DEFINE HSER_BAUD 9600
            DEFINE HSER_SPBRG 64
    
            WaitFor     var byte [6]
            CounterA    VAR BYTE
            clear
            PORTD = 0
            TRISD = 0
            Hserout ["Varidrive V2011.00 has started",13,10] 
     
    main:   
            GOSUB ClearArray     
            HSEROUT ["Main loop",13,10]   
            HSERIN   1000,Test_bloff,[str waitFor\6]
            
    Test_bloff:
            ARRAYREAD  WaitFor,6, Test_blon,[WAIT ("bloff",0)]
            LOW PORTD.4
            HSEROUT ["OFF",13,10]
            goto main
            
    Test_blon:
            ARRAYREAD  WaitFor,6, FAIL,[WAIT ("blon",0)]
            HIGH PORTD.4
            HSEROUT ["ON",13,10]
            goto main
            
    FAIL:
            HSEROUT ["FAIL!",13,10]
            GOTO main
            
    ClearArray:
            FOR CounterA = 0 TO 5
                    WaitFor[CounterA]=0
                    next
            RETURN
    now tell me it's not hard
    Last edited by mister_e; - 22nd August 2011 at 22:28.
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  2. #2
    Join Date
    Sep 2005
    Location
    Campbell, CA
    Posts
    1,107


    Did you find this post helpful? Yes | No

    Default Re: RS232 serial commands

    Wow! Next time I need some code written, I'll just state what I want to do, and let you guys write it.
    Charles Linquist

  3. #3
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default Re: RS232 serial commands

    good karma... that is
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  4. #4


    Did you find this post helpful? Yes | No

    Default Re: RS232 serial commands

    Quote Originally Posted by mister_e View Post
    Another Variant...
    Code:
            DEFINE OSC 40      
            DEFINE HSER_RCSTA 90h 
            DEFINE HSER_TXSTA 20h 
            DEFINE HSER_BAUD 9600
            DEFINE HSER_SPBRG 64
    
            WaitFor     var byte [6]
            CounterA    VAR BYTE
            clear
            PORTD = 0
            TRISD = 0
            Hserout ["Varidrive V2011.00 has started",13,10] 
     
    main:   
            GOSUB ClearArray     
            HSEROUT ["Main loop",13,10]   
            HSERIN   1000,Test_bloff,[str waitFor\6]
            
    Test_bloff:
            ARRAYREAD  WaitFor,6, Test_blon,[WAIT ("bloff",0)]
            LOW PORTD.4
            HSEROUT ["OFF",13,10]
            goto main
            
    Test_blon:
            ARRAYREAD  WaitFor,6, FAIL,[WAIT ("blon",0)]
            HIGH PORTD.4
            HSEROUT ["ON",13,10]
            goto main
            
    FAIL:
            HSEROUT ["FAIL!",13,10]
            GOTO main
            
    ClearArray:
            FOR CounterA = 0 TO 5
                    WaitFor[CounterA]=0
                    next
            RETURN
    now tell me it's not hard
    Thanks a lot, your code is perfectly understandable.

  5. #5
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default Re: RS232 serial commands

    ... And have a deliberate small mistake in before receiving the bomb-proof approval... but this... i'll let you the pleasure find it

    Enjoy!
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  6. #6
    Join Date
    Sep 2005
    Location
    Campbell, CA
    Posts
    1,107


    Did you find this post helpful? Yes | No

    Default Re: RS232 serial commands

    Steve.... I put lots of "deliberate" mistakes in my code as well.
    Charles Linquist

  7. #7
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default Re: RS232 serial commands

    Good grief, nice to know some of them are in Orbit
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  8. #8
    Join Date
    Sep 2005
    Location
    Campbell, CA
    Posts
    1,107


    Did you find this post helpful? Yes | No

    Default Re: RS232 serial commands

    Or at least they are supposed to be....
    Charles Linquist

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