Hello ...
I wanna dedicate PortE for software RS232, but don't understand the interrupt "philosophy". I saw that there is an UsartRX1Ready, but should the SerNreceive itself not be in a "On interrupt" routine, to allow background receiving at any moment ? I can't find the interrupt triggered by START of an incoming message ... Or does the UsartRX1Ready in fact mean the START of a transmission (in the help I understood that it means the END of it) ? And, if several bytes are received separately, are they put into a FIFO stack (and then, how can they be read ? ) or concatenated to a string ?
Thanks for help ...
Last edit: Bertrand BAROTH 2018-12-13
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
A Hardware USART would provide an internal flag that would be set when the RX pin detects an incoming transmission. This can be used to start an interrupt routine when so enabled.
A Software USART would have to poll the RX pin in the Main program loop by using the SerReceive method. Generally speaking a software USART would be run at a slower speed so as other periphereals and duties can be accomplished without missing the next incoming transmission.
The USART is a Byte oriented transaction, which of course can be strung together in as many Bytes as needed to pass on the required information. With the hardware USART there is a couple Byte FIFO. If you know ahead of time how many Bytes are in the message, then it is a little easier to handle either way.
Hope that helps, or mabe someone else has a better way of describing what you need?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Thanks for Your answer, at least I know that software RS232 is absolutely NOT what I am looking for ; the main problem is that I should POLL PERIODICALLY for an incoming message. I was thinking that the start of the message would automatically trigger the receive routine via an interrupt (logical state change on the corresponding pin).
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I know you have talked about the Atmel 90S and the mega8515 for your project? and I'm sure they could work out. But using say a more modern mega328p or Pic18f26k22 would bring in a lot of GCB demos to play around with. Also, it would make the extensive knowledge base here on the forum more accessible while you wrap your arms around various peripherals, serial communication and interrupts?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Sorry, they both don'have enough I/O lines, I need at least 29 of them for the "basic" functions of my railroad layout, and perhaps additional lines to control an EMIC 2 via RS232, for additional informations to the "operator" (for a countdown function before the next train starts, the layout will be able to be switched into an "automatic random mode", and the operator can switch back to manual mode at any time ; yes, I know, it is a bit unusual) . I can modify the dispatching of the lines to use the hardware U(S)ART, if the remaining lines of port D are only used as inputs there will not be any interference with the two RxD/TxD lines ...
In fact, "topologically seen" a simple oval, two rather simple stations, 3 trains in use (a double railcar is not on the picture), only one at a time but nevertheless it needs almost all I/O resources of a 8515 ! 5 bits for position detection, 6 bits for engine control, speed and momentum individually adjustable for each of the 3 trains (4 speed presets for each, according to the location on the layout, purely ... ANALOG, via the selecting of trimmers by analog switches and an integrating capacitor ! ), 3 bits for the 3 groups of turnouts, the remaining bits are for the "human interface". I don't use PWM because I read on several (railway) fori (is this correct ? ) that first it can damage the motors used for small scales (it is Z, 1/220), secundly it produces too many harmonics which could interfere with broadcasting, the tracks beeing a good antenna ... And, even if I would use one pin for PWM and integrate the signal to get are "stable" voltage, I would need to use some others to preset the speeds, maybe a menue system, and an interrupt to read periodically these inputs ; with my system all presets are "real time" without any interrupts.
The software project that I wrote needs about 3600 bytes of flash so a "smaller" version than the 8515 could fit, but does it exist, and is the difference in price really significant ?
And now I stop this thread, otherwise the forum will become a ... model railroad forum !
😄
1
Last edit: Bertrand BAROTH 2018-12-14
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
And this is the last post in this thread : the control electronics, with the 8515-board (some additional boards, especially the relays, are mounted under the main plate) ... The 8515-board will be modified to add an Emic-2 speech synthesizer.
Hello ...
I wanna dedicate PortE for software RS232, but don't understand the interrupt "philosophy". I saw that there is an UsartRX1Ready, but should the SerNreceive itself not be in a "On interrupt" routine, to allow background receiving at any moment ? I can't find the interrupt triggered by START of an incoming message ... Or does the UsartRX1Ready in fact mean the START of a transmission (in the help I understood that it means the END of it) ? And, if several bytes are received separately, are they put into a FIFO stack (and then, how can they be read ? ) or concatenated to a string ?
Thanks for help ...
Last edit: Bertrand BAROTH 2018-12-13
A Hardware USART would provide an internal flag that would be set when the RX pin detects an incoming transmission. This can be used to start an interrupt routine when so enabled.
A Software USART would have to poll the RX pin in the Main program loop by using the SerReceive method. Generally speaking a software USART would be run at a slower speed so as other periphereals and duties can be accomplished without missing the next incoming transmission.
The USART is a Byte oriented transaction, which of course can be strung together in as many Bytes as needed to pass on the required information. With the hardware USART there is a couple Byte FIFO. If you know ahead of time how many Bytes are in the message, then it is a little easier to handle either way.
Hope that helps, or mabe someone else has a better way of describing what you need?
Thanks for Your answer, at least I know that software RS232 is absolutely NOT what I am looking for ; the main problem is that I should POLL PERIODICALLY for an incoming message. I was thinking that the start of the message would automatically trigger the receive routine via an interrupt (logical state change on the corresponding pin).
I know you have talked about the Atmel 90S and the mega8515 for your project? and I'm sure they could work out. But using say a more modern mega328p or Pic18f26k22 would bring in a lot of GCB demos to play around with. Also, it would make the extensive knowledge base here on the forum more accessible while you wrap your arms around various peripherals, serial communication and interrupts?
Sorry, they both don'have enough I/O lines, I need at least 29 of them for the "basic" functions of my railroad layout, and perhaps additional lines to control an EMIC 2 via RS232, for additional informations to the "operator" (for a countdown function before the next train starts, the layout will be able to be switched into an "automatic random mode", and the operator can switch back to manual mode at any time ; yes, I know, it is a bit unusual) . I can modify the dispatching of the lines to use the hardware U(S)ART, if the remaining lines of port D are only used as inputs there will not be any interference with the two RxD/TxD lines ...
And this is the console ...
Thanks for sharing the pics, great looking project.
In fact, "topologically seen" a simple oval, two rather simple stations, 3 trains in use (a double railcar is not on the picture), only one at a time but nevertheless it needs almost all I/O resources of a 8515 ! 5 bits for position detection, 6 bits for engine control, speed and momentum individually adjustable for each of the 3 trains (4 speed presets for each, according to the location on the layout, purely ... ANALOG, via the selecting of trimmers by analog switches and an integrating capacitor ! ), 3 bits for the 3 groups of turnouts, the remaining bits are for the "human interface". I don't use PWM because I read on several (railway) fori (is this correct ? ) that first it can damage the motors used for small scales (it is Z, 1/220), secundly it produces too many harmonics which could interfere with broadcasting, the tracks beeing a good antenna ... And, even if I would use one pin for PWM and integrate the signal to get are "stable" voltage, I would need to use some others to preset the speeds, maybe a menue system, and an interrupt to read periodically these inputs ; with my system all presets are "real time" without any interrupts.
The software project that I wrote needs about 3600 bytes of flash so a "smaller" version than the 8515 could fit, but does it exist, and is the difference in price really significant ?
And now I stop this thread, otherwise the forum will become a ... model railroad forum !
Last edit: Bertrand BAROTH 2018-12-14
And this is the last post in this thread : the control electronics, with the 8515-board (some additional boards, especially the relays, are mounted under the main plate) ... The 8515-board will be modified to add an Emic-2 speech synthesizer.
Last edit: Bertrand BAROTH 2018-12-30