RS-232 Data bit option ?
Moderator: Benj
-
- Posts: 164
- Joined: Fri Jan 13, 2012 4:21 am
- Location: South KOREA
- Has thanked: 18 times
- Been thanked: 16 times
- Contact:
RS-232 Data bit option ?
Hi guys
I have always been very helpful. Thank you.
I need to get data to the RS-232 port while I'm working on the project. The protocol should receive 7 bits of data bit and 1 bit of stop bit. In FC8, however, only data bit 7 bit option is available. The data comes in incorrectly. I want to know the solution to this.
Thank you all the time.
I have always been very helpful. Thank you.
I need to get data to the RS-232 port while I'm working on the project. The protocol should receive 7 bits of data bit and 1 bit of stop bit. In FC8, however, only data bit 7 bit option is available. The data comes in incorrectly. I want to know the solution to this.
Thank you all the time.
-
- Valued Contributor
- Posts: 661
- Joined: Fri Jun 06, 2014 3:53 pm
- Has thanked: 184 times
- Been thanked: 203 times
- Contact:
Re: RS-232 Data bit option ?
Hi
What is it you are trying to do? Do you really need to manipulate bits or could the UART do a lot of the work for you?
This page might be helpful
https://www.engineersgarage.com/articles/what-is-rs232
Regards
What is it you are trying to do? Do you really need to manipulate bits or could the UART do a lot of the work for you?
This page might be helpful
https://www.engineersgarage.com/articles/what-is-rs232
Regards
-
- Posts: 164
- Joined: Fri Jan 13, 2012 4:21 am
- Location: South KOREA
- Has thanked: 18 times
- Been thanked: 16 times
- Contact:
Re: RS-232 Data bit option ?
I need stop bit setting. The indicater is only 7,1 none protocol. My Pc is well good. But FC8 is not working. Your page is not open.
- LeighM
- Matrix Staff
- Posts: 2178
- Joined: Tue Jan 17, 2012 10:07 am
- Has thanked: 481 times
- Been thanked: 699 times
- Contact:
Re: RS-232 Data bit option ?
Hi,
Could you give a bit more detail?
Are you trying to receive 7 bits + 1 stop bit on some hardware with code written in Flowcode?
If so, what is the target processor?
Does the system that sends the 7 bits + 1 stop have any time gap between data bytes, or does the next start bit come immediately after the previous stop bit?
Does the Flowcode project need to send 7+1 as well as receive?
Could you give a bit more detail?
Are you trying to receive 7 bits + 1 stop bit on some hardware with code written in Flowcode?
If so, what is the target processor?
Does the system that sends the 7 bits + 1 stop have any time gap between data bytes, or does the next start bit come immediately after the previous stop bit?
Does the Flowcode project need to send 7+1 as well as receive?
-
- Posts: 164
- Joined: Fri Jan 13, 2012 4:21 am
- Location: South KOREA
- Has thanked: 18 times
- Been thanked: 16 times
- Contact:
Re: RS-232 Data bit option ?
Hi,
Could you give a bit more detail?
My project is loadcell indicator value via modbus to SCADA.
Are you trying to receive 7 bits + 1 stop bit on some hardware with code written in Flowcode?
Yes
If so, what is the target processor?
18F26K22
Does the system that sends the 7 bits + 1 stop have any time gap between data bytes, or does the next start bit come immediately after the previous stop bit?
No gap. Data is relation. Protocol is ST,NT,9999999kg+cr+lf Maker aunaunce data 7bit stop 1bit. Parity is any.
Does the Flowcode project need to send 7+1 as well as receive?
Yes. Really need.
Thank you your interest.
Could you give a bit more detail?
My project is loadcell indicator value via modbus to SCADA.
Are you trying to receive 7 bits + 1 stop bit on some hardware with code written in Flowcode?
Yes
If so, what is the target processor?
18F26K22
Does the system that sends the 7 bits + 1 stop have any time gap between data bytes, or does the next start bit come immediately after the previous stop bit?
No gap. Data is relation. Protocol is ST,NT,9999999kg+cr+lf Maker aunaunce data 7bit stop 1bit. Parity is any.
Does the Flowcode project need to send 7+1 as well as receive?
Yes. Really need.
Thank you your interest.
- LeighM
- Matrix Staff
- Posts: 2178
- Joined: Tue Jan 17, 2012 10:07 am
- Has thanked: 481 times
- Been thanked: 699 times
- Contact:
Re: RS-232 Data bit option ?
That sounds like the usual 7 data + parity + stop.Parity is any.
Could you attach the datasheet for the sender?
- LeighM
- Matrix Staff
- Posts: 2178
- Joined: Tue Jan 17, 2012 10:07 am
- Has thanked: 481 times
- Been thanked: 699 times
- Contact:
Re: RS-232 Data bit option ?
Probably a problem
Your initial comments suggested that you think the UART transmits 1 start bit, 7 data bits and 1 stop bit,
are you sure that is the case?
I'm just checking that, because I think that is very unlikely, I would suspect that it is 1 start bit, 7 data bits, parity bit undefined and 1 stop bit.
And that your data reception problems are elsewhere?
Your initial comments suggested that you think the UART transmits 1 start bit, 7 data bits and 1 stop bit,
are you sure that is the case?
I'm just checking that, because I think that is very unlikely, I would suspect that it is 1 start bit, 7 data bits, parity bit undefined and 1 stop bit.
And that your data reception problems are elsewhere?
-
- Posts: 164
- Joined: Fri Jan 13, 2012 4:21 am
- Location: South KOREA
- Has thanked: 18 times
- Been thanked: 16 times
- Contact:
Re: RS-232 Data bit option ?
I will translate manual Korean to English in RS-232 section.
This time is GMT+9. I will do that tomorrow morning.
This time is GMT+9. I will do that tomorrow morning.
-
- Posts: 164
- Joined: Fri Jan 13, 2012 4:21 am
- Location: South KOREA
- Has thanked: 18 times
- Been thanked: 16 times
- Contact:
Re: RS-232 Data bit option ?
PDF document is RS-232 protocol.
- Attachments
-
- AD-4325_compressed.pdf
- (479.88 KiB) Downloaded 189 times
-
- Valued Contributor
- Posts: 661
- Joined: Fri Jun 06, 2014 3:53 pm
- Has thanked: 184 times
- Been thanked: 203 times
- Contact:
Re: RS-232 Data bit option ?
Hi
I assume you are using the OP-04 serial option?
I quickly grabbed a manual for the AD4325A online and in section H it clearly shows that it transmits a start bit followed by seven data bits, a parity bit then a stop bit much as Leigh suspected. Assuming you have your baud set correctly and data set to 7-bits you may also need to enable CTS/RTS (or just loop them). Depending on AD4325A setting you can have differing transmission formats. This refers to the data contained in the transmission, not the physical act of transmission which remains the same. For example it can send Code, Header 1 and Header 2 info at the beginning of the string or not depending on format.
You may want to try setting an interrupt handling routine on RxInt. In this fill a circular buffer exiting when no more characters are being received. In your main body, depending on the transmission format you could search the buffer for the presence of both a fixed character in the string and the LF (sent at the end). If found loop through the CB until you reach your required data.
Hope this helps
Regards
I assume you are using the OP-04 serial option?
I quickly grabbed a manual for the AD4325A online and in section H it clearly shows that it transmits a start bit followed by seven data bits, a parity bit then a stop bit much as Leigh suspected. Assuming you have your baud set correctly and data set to 7-bits you may also need to enable CTS/RTS (or just loop them). Depending on AD4325A setting you can have differing transmission formats. This refers to the data contained in the transmission, not the physical act of transmission which remains the same. For example it can send Code, Header 1 and Header 2 info at the beginning of the string or not depending on format.
You may want to try setting an interrupt handling routine on RxInt. In this fill a circular buffer exiting when no more characters are being received. In your main body, depending on the transmission format you could search the buffer for the presence of both a fixed character in the string and the LF (sent at the end). If found loop through the CB until you reach your required data.
Hope this helps
Regards
-
- Posts: 164
- Joined: Fri Jan 13, 2012 4:21 am
- Location: South KOREA
- Has thanked: 18 times
- Been thanked: 16 times
- Contact:
Re: RS-232 Data bit option ?
thank you for the reply.
I am reading the data7bit, stop 1bit on PC correctly. However, I tested various options in FC8 but it does not work.
I am reading the data7bit, stop 1bit on PC correctly. However, I tested various options in FC8 but it does not work.
-
- Valued Contributor
- Posts: 661
- Joined: Fri Jun 06, 2014 3:53 pm
- Has thanked: 184 times
- Been thanked: 203 times
- Contact:
Re: RS-232 Data bit option ?
Hi
OK if you can see the correct string on the PC it sounds like perhaps a setting or something simple is incorrect with your circuit. What microcontroller are you using? Is the clock source set correctly? Very easy to overlook and we have all done it (and most likely will again).
You could try this which I find helpful.
If you have a logic analyser connect it to chip Rx. Set the UART to echo. Monitor the Rx to ensure the pin is getting the correct signal. If not the problem is elsewhere. If so monitor the Tx pin. Anything the UART receives will be sent to the Tx (and analyser) so you can then see what is happening "within" the chip. If you have a good signal at the Rx pin but the chip is echoing nonsense you most likely have an incorrect UART / Clock setting.
Alternatively you could use the UART component and LCD.
Initialise components
Have an Interrupt on RXInt then a main loop (just looping)
In the Interrupt routine take the received character and then immediately print it to the LCD, exit routine at the end of transmission (timeout)
Anything coming in on the Rx port will be displayed on the LCD so again you can check to see what's happening. Hopefully you should receive characters in the specified format. Depending on your LCD you will of course run out of characters at some stage but you should be able to see if the incoming data is corrupted or not.
Common problems include incorrect clock settings, forgetting to initialise, incorrect Baud, incorrect data (7,8,9 bit) and flow control. I am assuming you are using a terminal program on your PC so check the UART settings are similar.
Regards
OK if you can see the correct string on the PC it sounds like perhaps a setting or something simple is incorrect with your circuit. What microcontroller are you using? Is the clock source set correctly? Very easy to overlook and we have all done it (and most likely will again).
You could try this which I find helpful.
If you have a logic analyser connect it to chip Rx. Set the UART to echo. Monitor the Rx to ensure the pin is getting the correct signal. If not the problem is elsewhere. If so monitor the Tx pin. Anything the UART receives will be sent to the Tx (and analyser) so you can then see what is happening "within" the chip. If you have a good signal at the Rx pin but the chip is echoing nonsense you most likely have an incorrect UART / Clock setting.
Alternatively you could use the UART component and LCD.
Initialise components
Have an Interrupt on RXInt then a main loop (just looping)
In the Interrupt routine take the received character and then immediately print it to the LCD, exit routine at the end of transmission (timeout)
Anything coming in on the Rx port will be displayed on the LCD so again you can check to see what's happening. Hopefully you should receive characters in the specified format. Depending on your LCD you will of course run out of characters at some stage but you should be able to see if the incoming data is corrupted or not.
Common problems include incorrect clock settings, forgetting to initialise, incorrect Baud, incorrect data (7,8,9 bit) and flow control. I am assuming you are using a terminal program on your PC so check the UART settings are similar.
Regards
-
- Posts: 164
- Joined: Fri Jan 13, 2012 4:21 am
- Location: South KOREA
- Has thanked: 18 times
- Been thanked: 16 times
- Contact:
Re: RS-232 Data bit option ?
I solved this problem. It is all your help. Thank you. FC8 has opened a new world for me. I can not C language.
The problem was an oscillator. 11.0592MHz crystal was attached and solved.
Thank you all for your attention.
I love FC8.
The problem was an oscillator. 11.0592MHz crystal was attached and solved.
Thank you all for your attention.
I love FC8.
-
- Valued Contributor
- Posts: 661
- Joined: Fri Jun 06, 2014 3:53 pm
- Has thanked: 184 times
- Been thanked: 203 times
- Contact:
Re: RS-232 Data bit option ?
Hi
Happy to hear you have solved your problem.
I am not a C-programmer either which is one of the reasons FC is great, and by using the C-Code Icon and the knowledge base I have greatly increased my understanding over the years.
Regards
Happy to hear you have solved your problem.
I am not a C-programmer either which is one of the reasons FC is great, and by using the C-Code Icon and the knowledge base I have greatly increased my understanding over the years.
Regards