Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Capturing Messages from RS-232 devices then turns on a particular LED.

Status
Not open for further replies.

macer_0001

Member level 1
Member level 1
Joined
Aug 15, 2009
Messages
36
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,286
Location
Manila
Activity points
1,491
I would like to capture the message from One panel. The panel has a printer fort. a serial printer port. I want to capture particular text like ALARM the Followed by Z001. Then, the LED 1 will lit. I preferred 9600 baud. And I'm using Atmel 2051 MCU.

The Question are:
1. Can I use polling method? Or, there is any way to capture a particular text?
2. What is the duration from the time sent a character to send another character?
3.Could please give a sample program for the receiver?

Thank you.
 

1. If you talk about software UART - yes, on 9600 you can use software UART to get the data
2. It could be zero, the gap between sent characters is not defined in RS232
3. The best approach for serial communication is to use circular FIFO - there were many talks about RS232 communication implementations in this forum

Some time ago I made similar project where I used for decoding the sequences CRC instead of holding the data into FIFO. I just made an algorithm to detect the delimiter (in your case Z001) and meanwhile added all bytes to the CRC. If the messages are fixed at the end you have to compare 16 bit or 32 bit digits to the etalons (also digits). This is extremely fast very useful method if you have big list of messages. If you have for example 100 different long message you'll not have enough time to decode them so the new message can overlap the old one plus you need excessive amount of RAM. The CRC approach decoding is extremely fast and doesn't require any RAM for holding the messages.

I'll try to find out the project and post it here - it's exactly what you want to do
 
use the UART functions. It can be configured either polling method (but its in blocking stage) or Interrupt method. Also set the timer values for the desired baud rate (here 9600) . Its a simple procedure. Just search in net with 8051 UART programming.
 
See attached a tested and working project for decoding sequences with CRC. In short the idea is:
1. There is a long list of sequences which should be detected, all they finish with some delimiter
2. Instead of holding the sequence in the RAM and then to compare it with sequence patterns holded in the FLASH we generate for each incoming sequence a CRC16. At the end we need to compare only 2 bytes with the array of 16 bit patterns in the flash. The result is extremely fast detection of the sequences and no need of big RAM

The project contains all what you need - you just need to modify the patterns, it's compiled with KEIL. To generate new patterns for compare (array of 16 bit digits) you need probably to write simple PC software. In this project I simply used a break point and when sending knwon pattern I just looked at the accumulated CRC.
 

Attachments

  • nara.zip
    16.4 KB · Views: 124
Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top