MIKROBASIC Soft_Uart to PICBASIC SEIRIN2?


Closed Thread
Results 1 to 20 of 20

Hybrid View

  1. #1
    Join Date
    Jun 2011
    Posts
    24

    Default MIKROBASIC Soft_Uart to PICBASIC SEIRIN2?

    I am trying to use Mikrobasic and PicBasic to communicate between chips. My receiver is using SERIN2 porta.1,84,10,comfail,[wait ("@"),STR t1pulse\6] but my sender is using MIKROBASIC SOFT_UART and I can't seem to get them to communicate properly. If anyone has any experience with this let me know how to fix it. The receiver is receiving values but they aren't right at all. How do I get these to communicate properly. I need to send an array of 6 values between 0 and 180. Any help is appreciated.

  2. #2
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,605

    Default Re: MIKROBASIC Soft_Uart to PICBASIC SEIRIN2?

    Hi,

    Are you sure the sender and reciever are using the same polarity? Mode 84 in PBP means 9600baud, true. Are you sure that sender is sending the data true and not inverted? 16468 is the mode for 9600baud, inverted - if in doubt, give that a try.

    /Henrik.

  3. #3
    Join Date
    Jun 2011
    Posts
    24

    Default Re: MIKROBASIC Soft_Uart to PICBASIC SEIRIN2?

    Yup, first thing I made sure of. 9600 Baud, 8N1 true. I think it's just not sending the data the same because of the type. When I send a number to the SERIN2 statement like I outlined in the first post, how does the statement expect the data to come? what I mean is does it expect 3 ascii values for each digit individually to come like if i send 128 will it expect to get, 1 in ascii followed by 2 in ascii followed by 8 in ascii? or does it receive the binary value of 128 and convert to STR?

  4. #4
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,605

    Default Re: MIKROBASIC Soft_Uart to PICBASIC SEIRIN2?

    Hi,
    The line
    Code:
    SERIN2 porta.1,84,10,comfail,[wait ("@"),STR t1pulse\6]
    Will recieve up to 6 bytes and store each byte in the t1pulse array. In this case it expects each value as one byte, not the ASCII representation of the value (for that you use the DEC modifier). If the sending device sends the "raw" value 128 you'll get 128 in t1pulse[0]. If it sends the value in ASCII you'll get 49 in t1pulse[0] because 49 is the ASCII code for '1'.

    I hope that makes sense.

    /Henrik.

  5. #5
    Join Date
    Jun 2011
    Posts
    24

    Default Re: MIKROBASIC Soft_Uart to PICBASIC SEIRIN2?

    I wrote the received values to to eeprom and read them and with 110,110,110,110,110,110 sent, it received 6E,AE,6E,EE,6E,EE. These are 110,174,110,238,110,238.

    The similarity is in the binary,
    Hex DEC bin
    6E 110 0110 1110
    AE 174 1010 1110
    EE 238 1110 1110

    the last 4 bits are all the same and the first 4 arent too different. I will try changing the sender type to unsigned instead of integer and see what changes.

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

    Default Re: MIKROBASIC Soft_Uart to PICBASIC SEIRIN2?

    I may miss the point but... why having a Sender code written in MikroBasic and a receiver in PicBasic?
    Steve

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

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