View previous topic :: View next topic |
Author |
Message |
Khansokhua
Joined: 06 Nov 2021 Posts: 92
|
|
Posted: Fri Jan 13, 2023 11:46 am |
|
|
In addition, I use 4MHz crystal with two 22pF capacitor. Vdd pins are connected direct 5 V. Vss pins are direct connected ground. MCLR pin is connected 5V with 10k resistor. |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19545
|
|
Posted: Sat Jan 14, 2023 6:32 am |
|
|
Look in the code library at:
[url]
http://www.ccsinfo.com/forum/viewtopic.php?t=59924
[/url]
This uses a timer and the CCP, to generate a smoothly controllable pulse
width.
Also look in the drivers directory at servos.c
This is a driver to control two motor control servos (these give speeds
rather than positions), but operation is exactly the same. |
|
|
Khansokhua
Joined: 06 Nov 2021 Posts: 92
|
|
Posted: Mon Jan 30, 2023 3:06 pm |
|
|
I succeeded driving servos. Next topic is how can I control these servos remotely?
I need to use the smallest size components for prevent any placement problems.
What choices do I have? NRF24L01 is an option? |
|
|
temtronic
Joined: 01 Jul 2010 Posts: 9244 Location: Greensville,Ontario
|
|
Posted: Mon Jan 30, 2023 5:27 pm |
|
|
'remotely' ?
as in wireless communications ?
do you need two way data ?
what distance is required ?
why 'smallest size' ?
I'm presuming 'battery' operation, yet servos take a LOT of power and all RF modules do as well, so 'smallest size' isn't really needed as you'll have BIG batteries to power the unit. You need to investigate actual power consumption based on operation and time of use, to get the battery capacity. Now DOUBLE the rating ! THAT will be the minimum you'll actually need IF used at room temperature.
You have lots of 'wireless' options... simple IR units like TV remotes are cheap and easy to interface. BLE modules ( Bluetooth Low energy) are very common. 433MHz RF modules, 2.4GHz like you posted.
You'll need to use the HW UART AND you'll need proper 5v to 3v logic level translators ! ALL 'rf modules' are 3 volt based NOT 5. While 5v 'tolerant' the LOGIC levels are 3v. You also need to use ISR and buffer the data,setup a parsing function to decode commands and such. Be very careful...that PIC doesn't have a lot of RAM.
Also since you are using servos ,you'll have to filter the power supply feeds to servos, the PIC and the RF module ! |
|
|
Khansokhua
Joined: 06 Nov 2021 Posts: 92
|
|
Posted: Mon Jan 30, 2023 6:20 pm |
|
|
30 meter distance is enough.
It will used at room temperature. |
|
|
Khansokhua
Joined: 06 Nov 2021 Posts: 92
|
|
Posted: Tue Jan 31, 2023 8:42 am |
|
|
I had seen those ısr codes while poking around this forum but I have no idea what they are, how can I learn these commands? |
|
|
temtronic
Joined: 01 Jul 2010 Posts: 9244 Location: Greensville,Ontario
|
|
Posted: Tue Jan 31, 2023 9:00 am |
|
|
Start reading the datasheet for your PIC, the CCS manual, examine the CCS supplied examples, look in the code library here, search this forum, use Google to locate 'how to use ISRs with PICs', for sure goto Microchip's website and scan their 'application notes'.
While several (100's I suppose) books have been written, I have no idea which ones would be 'best' at teaching ISRs. Probably lots of websites where guys have posted 'how to do it' pages.... |
|
|
temtronic
Joined: 01 Jul 2010 Posts: 9244 Location: Greensville,Ontario
|
|
|
Khansokhua
Joined: 06 Nov 2021 Posts: 92
|
|
|
|