RS232 serial communication not working

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 5.
To post in this forum you must have a registered copy of Flowcode 5 or higher.

Moderator: Benj

imtiaz9
Posts: 15
Joined: Sat Aug 10, 2013 7:16 am
Been thanked: 1 time
Contact:

RS232 serial communication not working

Postby imtiaz9 » Thu Feb 15, 2018 7:32 am

I want to communicate 18f452 device to PC through RS232 and try to display a byte number on hyperterminal. But only different symbols are display when i pressed any key on 18f452. Any idea to solve it
Attachments
SDR.jpg
SDR.jpg (44.45 KiB) Viewed 1219 times
452.fcf
(19 KiB) Downloaded 47 times

User avatar
Benj
Matrix Staff
Posts: 14217
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4356 times
Been thanked: 4095 times
Contact:

Re: RS232 serial communication not working

Postby Benj » Thu Feb 15, 2018 11:05 am

Hello,

You are simply printing the TOTAL variable as a byte if you look at the ASCII table then you can see that the values 0-255 will generate lots of different characters.

http://www.asciitable.com/

If you instead convert total to a string and then print the string then this will print the number as an ASCII set of digits representing the value of the number.

str = ToString$(TOTAL)

If you only want to print a single digit 0-9 then you can change the SendRS232Char parameter from TOTAL to TOTAL + '0'. This shifts the value up by the ASCII value for 0, again refer to the ASCII table link for info. You will also need to bounds check the TOTAL value so when incrementing and decrementing the value it cannot go lower than 0 or higher than 9.

Hope this helps.

imtiaz9
Posts: 15
Joined: Sat Aug 10, 2013 7:16 am
Been thanked: 1 time
Contact:

Re: RS232 serial communication not working

Postby imtiaz9 » Fri Feb 16, 2018 7:55 am

thanks benj. its solved...