I need HELP send & receive via RS232

Antworten
KMtronic
Beiträge: 4
Registriert: Donnerstag 15. Juli 2010, 12:19

I need HELP send & receive via RS232

Beitrag von KMtronic » Freitag 16. Juli 2010, 14:15

Hello, I'm beginner and I want to build some project on ProfiLab.

First step : Reading digital inputs from microcontroller connected to PC via RS232 port 9600/8/N/1.
Protocol:
ProfiLab need to send request to microcontroler "255 128 0" in decimal (HEX "FF 80 00")
Microcontroller reply to request "255 128 0" or "255 128 1" where last byte is status digital input.

Project must read 8 digital inputs and show statuses with 8 LED's.
Commands are from "255 128 00" to "255 135 00".

I test several ways but until now I don't have any success.

We will be very grateful for some help.

Best regards
Dateianhänge
Inputs.prj
(3.81 KiB) 242-mal heruntergeladen

KAKTUS
Beiträge: 645
Registriert: Samstag 18. Oktober 2008, 21:12

Re: I need HELP send & receive via RS232

Beitrag von KAKTUS » Samstag 17. Juli 2010, 00:15

Hi KMtronic,

please test it, and setup the com ports first. The receive part works at my pc.
Dateianhänge
255 128 0.prj
(12.58 KiB) 280-mal heruntergeladen
stachlige Grüße, Kaktus

KMtronic
Beiträge: 4
Registriert: Donnerstag 15. Juli 2010, 12:19

Re: I need HELP send & receive via RS232

Beitrag von KMtronic » Sonntag 18. Juli 2010, 09:56

Hi KAKTUS,

Great job!!! Thank you very much!

Your project help my to understand how all must work.
And using it I just have working 'Inputs' part of my experiment project.

To make simple I change little protocol and add 8 more inputs.
So in a moment Read inputs command is '255 128 00' ("FF 80 00") and microcontroller send back '255 128 xx xx' where 'xx xx' are status all 16 inputs in BIN format. '255' ('FF) - all inputs are 5V, 0 inputs are 0V.

I attach project in working state. Also screenshots Front panel and log serial communication.

Next part (Digital Outputs) will start short as possible...
Any ideas welcome.
I think to use Read inputs command for Outputs. Some like '255 128 oo oo' where 'oo oo' will be for control 16 Outputs.

MfG ;)
Dateianhänge
RS232_log_01.jpg
RS232_log_01.jpg (136.55 KiB) 2777 mal betrachtet
255 128 0_v2.prj
(13.08 KiB) 218-mal heruntergeladen
Inputs_01.jpg
Inputs_01.jpg (52.31 KiB) 2766 mal betrachtet

Antworten

Zurück zu „Thema RS232“