Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.
|
Forum Index : Microcontroller and PC projects : Relais controlled via Serial RS232
Page 3 of 3 | |||||
Author | Message | ||||
Turbo46 Guru Joined: 24/12/2017 Location: AustraliaPosts: 1584 |
And to use RS485 rather than RS422. And don't forget to use a CRC for security. Bill Keep safe. Live long and prosper. |
||||
Mixtel90 Guru Joined: 05/10/2019 Location: United KingdomPosts: 5648 |
Sod CRC - I tried reading up on it the other day and it fried a couple of brain cells. It's too hard for me if you want compatibility with anyone else. ;) If you're *really* lucky you'll get ACK, NAK and a checksum. :) If you're *really really* lucky I might even use something other than plain ASCII text too! RS485, definitely. I did consider playing with CANbus at one time. Edited 2021-07-18 18:45 by Mixtel90 Mick Zilog Inside! nascom.info for Nascom & Gemini Preliminary MMBasic docs & my PCB designs |
||||
Turbo46 Guru Joined: 24/12/2017 Location: AustraliaPosts: 1584 |
Using a CRC is not difficult. Look up MODBUS CRC or Xmodem CRC in fruit of the shed. You don't have to use the MODBUS or Xmodem protocols to use the CRC. Just tack it on to the end of the message and check it when received. Easy peasy. If the risk of operating the wrong device is no problem to you then don't bother but in my former line of work it could cost lives and/or do untold damage. It would be embarrassing in a commercial product too. Bill Keep safe. Live long and prosper. |
||||
Tinine Guru Joined: 30/03/2016 Location: United KingdomPosts: 1646 |
For master/slave, a simple checksum is all that's required. If not, then you have electrical issues that need to be corrected. The vast majority of industrial CNC machinery and other motion-control applications, use quadrature encoders for feedback. These also use differential line transmitters/receivers and all these do is transmit 5v pulses to be counted by the controller. Any corruption here could result in destroyed machinery and possibly, personal injury. And what about SPI? |
||||
Turbo46 Guru Joined: 24/12/2017 Location: AustraliaPosts: 1584 |
No self respecting SCADA system would use a simple checksum. Sometimes electrical issues are beyond your control, high voltage switching and lightening for instance. Proper earthing and shielding will help as will secure communications. SPI, I2C and TTL rs232 should really only be used within a PCB or a shielded case. I know people use these for external communications and get away with it but it's not for me. My father used to tell me 'If a job is worth doing it's worth doing well' Sorry for the sermon, if you thing 'near enough is good enough' then go for it. Bill Keep safe. Live long and prosper. |
||||
Volhout Guru Joined: 05/03/2018 Location: NetherlandsPosts: 3422 |
We are having a nice discussion on the best implementation, but have lost the thread starter, who is probably scared away by the comments. I am just as guilty.... PicomiteVGA PETSCII ROBOTS |
||||
Turbo46 Guru Joined: 24/12/2017 Location: AustraliaPosts: 1584 |
You're right Volhout, sorry for my rant it's not really fitting for the original post. It's neatly built and it would be interesting to know a little more, like what he uses it for and how. Bill Keep safe. Live long and prosper. |
||||
Tinine Guru Joined: 30/03/2016 Location: United KingdomPosts: 1646 |
Well he did state that he was a hobbyist. I would have learned a heck of a lot quicker had these discussion groups existed back in the day. |
||||
Tinine Guru Joined: 30/03/2016 Location: United KingdomPosts: 1646 |
"Networked Modular Control" Been around for 22 years. I have strings of these things, commanded by E-100s. Never had C/S error yet @230KBaud (overkill, BTW) However, the device has a couple of serious limitations for my application so I have recreated and expanded the functionality, using a PIC32MX170 (albeit not using MMBasic). I really like the NMC protocol (see attached datasheet) and have adopted it as my new standard. Craig picsrvsc.pdf |
||||
Mixtel90 Guru Joined: 05/10/2019 Location: United KingdomPosts: 5648 |
CRC is excellent - I'm not knocking it. However, if you are the type of person who would trust heavy rotating machinery to a RP2040 - especially at the present stage of its development - then I doubt if the extra security of CRC is really worth the hassle over just using parity bits TBH. They are both very bad ideas. It's unlikely that most hobbyists will do much that's more dangerous than switching a light on (and the biggest risk is probably that they'll use a 30vDC rated relay to switch 240vAC) so I think there's plenty of justification for keeping things as simple as reasonably possible, initially anyway. There's no real reason not to use i2c over most domestic distances and forget having to use drivers etc. It works well enough if you only need a single talker and avoid running the wiring in electrically noisy environments. You can also use logic level UARTs for multi-drop if there aren't too many stations. SPI is great - especially if you can daisy chain devices. *Very* fast. Not a lot of use for off-board communication really though. Mick Zilog Inside! nascom.info for Nascom & Gemini Preliminary MMBasic docs & my PCB designs |
||||
Tinine Guru Joined: 30/03/2016 Location: United KingdomPosts: 1646 |
Sure but as per the example I already presented; as I type this, there are millions of CNC machines delivering hundreds of thousands of encoder counts/second to CPUs, using the exact same electrical components and with zero error checking....are they smashing themselves to pieces? No! Some engineers get too hung up on something that they have been told or read about. |
||||
Page 3 of 3 |
Print this page |