![]() |
|
#1
|
|||
|
|||
decoding incomming data and screen refreshHello,
first of all, sorry for my english, I hope you will understand me. I'm a beginner in c programming, which can explain the level of my questions. A telegram (constituted of letters, numbers and symbols sequence) arrives periodically (incoming data frequency faster or not than the processor's one). The aim is to decode it and establish a classification. For doing this, I guess I will take each incoming caracter , store it in a buffer with a pointer and, when the entire telegram has been received, decode it and find the class. During this time, I need to wait for the following caracters. So, I don't want to interrupt the incoming messages main loop. Moreover, from one classification to another (one measurement to another), I'd like to refresh the screen on which I want to display the current class found. Is anybody here who can help me (for the algorithm or better for the programming)? I'm sorry for the level of my questions (I hope at least you've understood them!) and thank you very much in advance for your help. Jé |
|
#2
|
|||
|
|||
Re: decoding incomming data and screen refreshQuote:
English is not the problem. Understanding the problem is the problem. The C language and library functions don't know anything about telegrams. So, the question is: how is your sytem receiving telegrams? Is it a PC with an ethernet connection that is receiving the data? Is it an embedded system with special purpose hardware connected to a telegraph wire? Or what? If it is standard hardware and a standard operating system then you (and we) must understand the hardware/software interface to whatever input-output channel is involved. Perhaps device drivers already exist that collect the bytes of the message and allow user programs to read them as they have time. Low-level hardware driver functions (which may be interrupt driven) are usually supplied with the operating system (for example the TCP/IP functionality for an Ethernet connection), and applications programmers don't have to worry about such details. They write code that interacts with sockets the same way that they would read and write data from and to files. If you have some special hardware, you might have to write your own drivers. If it is an embedded system with no operating system, then interrupt service routines would have to be developed for whatever special I/O devices are connected. For example, an interrupt service routine could store characters (or bits or whatever) as they come into the system into some kind of FIFO that can be read by the application whose job it is to classify and route the messages. The application routine could have a loop that continuously polls the status of the FIFO to determine when new data are available, process data, route it, or whatever, and report results by updating a screen. These topics extend beyond the scope of a general programming assistance forum such as this one, but if you have some specific questions (and, particularly, C language or library topics) there are people here eager to try to find a way to help. Some contributors here may have specific experience in network programming, Windows programming, etc., and can either help you directly or can point you to helpful places. Your part: 1. Describe the problem. Data rate, kind of processing required, etc. Where does the input come from? Where does the output go? 2. Describe the system. CPU/Operating system, hardware connections, etc. 3. Describe the development environment. Is the software being developed on the same system as it will be used? Or is it cross-compiled on a desktop (or other) system to run on a target that is different? Or what? What compiler, etc. Regards, Dave |
|
#3
|
|||
|
|||
Re: decoding incomming data and screen refreshthank you for your interest
I will use metrowerks software environment for programming and afterwards implemenet it on the developed hardware . I will also use an LCD display connected to the microcontroller star12 via a parallel interface. In fact, I've created a pcb constituted of a microcontroller, a LCD display, power supply (and other components...). This will be a tester for occupant classification. The speed of the processor should be around 8MHz. I have my tester connected to the Multi gateway with a serial interface (RS232 cable) and the Multi gateway is connected to the occupant classification sensor via GMLAN standard communication interface which transmits messages at 38400 Bauds. I have to send a request, receive then a kay which enables the communication and thereafter will receive messages periodically. Each character of the answer telegram shall arrive periodically so I must store it on a buffer and when the whole telegram will be receive I can decode it and find the class. First of all I will initialize the ports (of the microcontroller, of the MAX232 and of the display) as I/O, IN or OUT according to the data sheets I have (for the parallel interface, the ports receiving the data bits transmitted between the microcontroller and the display will depend on the value of the R/W and the enable signals. Thereafter I send the request telegram to the MGW so as to enable GMLAN communication, wait for the answer telegram and afterwards wait for the incomming messages received without previous request. I must store all the data and wait at the same time for the new incomming characters, and since the speed of the incomming messages should be very slow compared to the speed of the processor, I can use an interruption to store the incoming data. When the whole telegram has been received, I just have to take all the data sequentially, decode them, refresh the display and display a class found or an error signal. I hope I have not forgotten to tell you important things. Thank you again in advance |
|
#4
|
|||
|
|||
Re: decoding incomming data and screen refreshQuote:
Quote:
1. You are a beginner in C. Do you have any programming experience? Specifically: assembly language for the HC12 family of microprocessors. It is probable that the lowest level interrupt service routine will be in assembly language (maybe assembler operations embedded in the C source code file). 2. It seems that you have done the hardware design for the project and have a good idea on how to test it. (That's a really Good Thing.) How many people are on the project team? Do any others have programming experience? 3. Since I don't have any experience with this hardware or with the Metrowerks development tools, I can't offer any specific help (maybe someone else here can help). I would suggest that you start at the home pages of the hardware and software vendors' sites: Freescale and Metrowerks. Search these for application notes and hardware/software examples. And, this is very important, you might find links to user groups or discussion forums where people have asked and answered questions about interrupts, I/O speeds, etc. for hardware and software implementations similar to yours. You can search for other places with discussion groups, such as embeddedrelated 68hc12 discussion group 4. The specific steps for putting together a complete embedded software system are considerably different than the steps for creating a C program to run in a hosted environment (a desktop PC, for example). The C language for the embedded system may (or may not) be a considerable subset of standard C (lots of them have no floating point data types, for example). There are always extensions to the C language to allow interface to assembly language routines, or for embedding assembly language operations in the C code. There are always things like defining the RAM and ROM hardware space that affect the linker (not part of the C language, but maybe some special #defines or #pragmas). Typically for embedded systems, you can address memory directly from user space (including memory-mapped I/O). Quite often there is no memory management (so there is no such thing as user space and protected space). There may be no operating system at all (so no system() calls), but there may be a well-defined set of functions or macros to address and initialize hardware registers at startup time or during program execution. 5. Bottom line: For someone completely comfortable and somewhat of an expert in the C language, putting together an embedded system is a learning experience that is challenging (but fun). There is very little chance that people sitting at a PC and programming in C all day every day can answer even the simplest specific questions about how to write an interrupt service routine and link it to a program loop for an embedded system. 6. I'm sure that some of us here would like to see more of your efforts and would like to help wherever we can, but it's a specialty that pretty much requires someone with specific experience with the kind of system that you are dealing with. Regards, Dave |
|
#5
|
|||
|
|||
Re: decoding incomming data and screen refreshHi Dave,
I just have finished my studies and I have done few programming theorical courses in C, C++, Pascal, assembler, but it's the first time I have to do programming not as an exercize but in a precise project. In my project, the programming language must be C (in embedded system it's similar to assembler). I work in a compagny for an internship, so in an electronic team, with other engineers and programmers who have of course more experience than me. However I am the only one who work on this subject: I can of course ask for some help, but I have to do everything by myself. Thank you for the links of forum discussions you gave me (I didn't know them) : they are very usefull and I will visit them as soon as possible. I understand that you cannot answer to such a precise question, when I will be able to go forward and to be more accurate in the programming steps I will deal with, I will write anothers messages on this forum, hope that you and others person will be able to help me. For the moment I'm searching for all the software requirements and it's not a simple thing!! So thank you very much and hope to hear from you soon, when I will be able to ask some accurate questions. Jerem |
|
#6
|
|||||
|
|||||
Re: decoding incomming data and screen refreshQuote:
I don't expect schools to turn out people ready to begin contributing any specialized skills as a member of a project team. The most important thing that you can learn in school (in my feeble-minded, but honest, opinion) is learning how to learn. Sometimes you ask an "expert", but you really learn by finding out things more-or-less on your own. (With the internet as #1 research tool.) Quote:
Quote:
Quote:
Well, if it were easy --- anyone could do it! Quote:
I am very interested, and I know that there are lots of others here who also are interested (contributors and lurkers alike). Let us know how it goes. Regards, Dave So I visited www.pyrotechnics.com/forums and did a search on how to start a fire. Well, the result came back: "Sorry - no matches.", so I left. |
Recent GIDBlog
Python ebook by crystalattice
| Thread Tools | Search this Thread |
| Rate This Thread | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| [Include] Doubly-linked List | dsmith | C Programming Language | 6 | 14-Apr-2006 13:12 |
| Need Help reading HEX data from a sensor | Moooey | C Programming Language | 4 | 09-Mar-2005 13:46 |
| [CONTEST?]Data Structure Test | dsmith | C Programming Language | 2 | 06-Jun-2004 15:13 |
Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The