|
|
View previous topic :: View next topic |
Author |
Message |
BillNg
Joined: 21 Apr 2014 Posts: 1
|
SPI daisy chain master 16F1938 to 5 slaves of 16F1823. |
Posted: Mon Apr 21, 2014 10:26 am |
|
|
Dear All,
I would like to get help on the codes for running 10 DC motors like this:
Master 16F1938 has
1. BUS chain to control 5 slaves 16F1823 which run 2 DC motors each with L298HN bridge.
2. Pressure control line to stop motor.
3. LCD display
4. App link with Bluetooth
Slave 16F1823 to operates 2 motors for each.
How can I do it? Please help if you can and I am a beginner for microcontrollers.
Thanks a lot,
BillNG _________________ SPI daisy chain master 16F1938 and 5 slaves of 16F1823. Please help me with the codes to run 10 DC motors from 5 slaves.
Master has an LCD, app via Bluetooth and pressure control. |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19499
|
|
Posted: Mon Apr 21, 2014 10:41 am |
|
|
Seriously for multiple slave devices on one bus, use I2C, rather than SPI. You gain nothing from using SPI. I2C, has addressing, so directly allows multiple slaves on one bus. SPI doesn't. You can have multiple 'dumb slaves' (no data returned), by just having an address line to each device to enable it, but to have slaves that return data, requires the slave devices to have the ability to disable their output pins (extra hardware, not present in the PIC...).
If by 'daisy chain', you mean passing messages 'through' the devices, the added complexity of adding a 'target ID' and receiving and the retransmitting each message, will degrade speed, and give massive complexity. |
|
|
temtronic
Joined: 01 Jul 2010 Posts: 9221 Location: Greensville,Ontario
|
|
Posted: Mon Apr 21, 2014 11:45 am |
|
|
This certainly is NOT a project for a 'beginner' !!! I can see hundreds of manhours getting it all to work right and I've been PICking for almost 20 years.
Break the project down into small 'sub-projects'.
1) get the 'master' to interface with the LCD.
2) get the 'master' to communicate with the 'pressure sensor'.
3) get the 'master' to control ONE motor.
4) get the 'slave' to control a motor(simple.copy motor functions from 'master', more or less.
5) get the 'master' to communicate with a slave.
Seriously there is a LOT of design and thought that has to be done on this project. 'Little' things like when the master loses communications to the slave,WHAT really controls the project? A KPD on the master or data from a PC ? Power supply design....separate units per slave/2 motor or one BIG one?
I could ask 100 real questions...but you must start off small, build upon what you learn.Ask specific questions and the guys here will help. BE aware that the 'examples' folder is FULL of working code 'segments' for most of what you'll need. Though not a 'real-complete' program,perfect for testing.
hth
jay |
|
|
ezflyr
Joined: 25 Oct 2010 Posts: 1019 Location: Tewksbury, MA
|
|
Posted: Mon Apr 21, 2014 2:01 pm |
|
|
Hi,
Chances are the OP 'parachuted' into the forum via a Google search. Highly doubtful that they are even using the CCS compiler!
Frankly, I'm surprised they didn't ask for WiFi connectivity as well
John |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|