hersin,hersout


+ Reply to Thread
Results 1 to 3 of 3

Thread: hersin,hersout2578 days old

  1. #1
    rverm
    Guest rverm's Avatar

    0 Not allowed!

    Default hersin,hersout

    i am having a little problem with the hersin,hersout. here is the code for hersout. it seems to be working ok.
    Device = 18F23K20

    Xtal 4
    TRISA = 0
    TRISB = 0
    TRISC = 0
    Dim var1 As Byte
    Dim cat As Byte
    Declare Hserial_Baud = 9600 ' Set baud rate to 9600
    Declare Hserial_RCSTA = %10010000 ' Enable continuous receive
    Declare Hserial_TXSTA = %00100000 ' Enable transmit and asynchronous mode
    Declare Hserial_Clear = OFF ' Clear the buffer before receiving

    MAIN:
    For var1 = 0 To 25
    HSerOut [Dec var1] ' Receive a byte serially into Var1
    Print Dec var1, " " ' Display the byte received
    DelayMS 500
    Cls
    Next var1
    GoTo MAIN ' Loop forever


    However the hersin doesnt seem to work corrrectly.
    Device = 18F23K20
    Xtal 4
    TRISA =0
    TRISB =0
    TRISC=0

    Declare Hserial_Baud = 9600 ' Set baud rate to 9600
    Declare Hserial_RCSTA = %10010000 ' Enable continuous receive
    Declare Hserial_TXSTA = %00100000 ' Enable transmit and asynchronous mode
    Declare Hserial_Clear = On ' Clear the buffer before receiving
    Dim Var1 As Byte
    Var1 = 60
    Loop:
    HSerIn 1000, Timeout, [Var1] ' Receive a byte serially into Var1
    Print Dec Var1' Display the byte received
    DelayMS 50
    Print At 2,1,"loop"
    DelayMS 500

    GoTo Loop ' Loop forever
    Timeout:
    Cls
    Print 2,1, "TIMED OUT" ' Display an error if Hserin timed out
    GoTo Loop

    it worked a couple of times in protues then quit working ok. dont know why? this is one area that i have

    not worked in at all. but i would like to get familiar with soon.
    thanks



































Attention

This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

The advertisements we display are relevant to this web site and your browsing history

Please consider supporting us by disabling your ad blocker.


Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

If you can, please report issues in the forum area WebSite / Forum Issues


Thank you for your attention.

  • #2
    PA1OKZ
    Guest PA1OKZ's Avatar

    0 Not allowed!

    Default Re: hersin,hersout

    You have to set the TRIS register for the subsequent serial input pin to 1 and because of your relatively long loop time, the delay might be too large to buffer the incoming data. It might also be worth to set the serial clear bit off.

  • Attention

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

  • #3
    rverm
    Guest rverm's Avatar

    0 Not allowed!

    Default Re: hersin,hersout

    Your suggestions worked. It will diplay the data after timed out displays and its 3 or 4 numbers behind. Like hersout can be on 12 but the display for hersin will show (timed out 46) . 6 being the number it has at the moment. It will continue to do that until it reaches 15 then it just says timed out after that.
    I still think protues is part of the problem.

  • Attention

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

    Thread Information

    Users Browsing this Thread

    There are currently 1 users browsing this thread. (0 members and 1 guests)

       

    Members who have read this thread since 20th November 2019, 21:03 : 1

    Actions :  (Set Date)  (Clear Date)

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

    Tags for this Thread

    Posting Permissions

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