CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

REMOTE CONTROL Wıth a pic MCU
Goto page Previous  1, 2
 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
Khansokhua



Joined: 06 Nov 2021
Posts: 92

View user's profile Send private message

PostPosted: Fri Jan 13, 2023 11:46 am     Reply with quote

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: 19539

View user's profile Send private message

PostPosted: Sat Jan 14, 2023 6:32 am     Reply with quote

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

View user's profile Send private message

PostPosted: Mon Jan 30, 2023 3:06 pm     Reply with quote

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: 9243
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Mon Jan 30, 2023 5:27 pm     Reply with quote

'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

View user's profile Send private message

PostPosted: Mon Jan 30, 2023 6:20 pm     Reply with quote

30 meter distance is enough.
It will used at room temperature.
Khansokhua



Joined: 06 Nov 2021
Posts: 92

View user's profile Send private message

PostPosted: Tue Jan 31, 2023 8:42 am     Reply with quote

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: 9243
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Tue Jan 31, 2023 9:00 am     Reply with quote

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: 9243
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Tue Jan 31, 2023 4:20 pm     Reply with quote

https://universal-solder.ca/product/ir-remote-control-sender-receiver-kit-for-arduino-etc/

from a new vendor here in Canada.....
it might work for you ??
Khansokhua



Joined: 06 Nov 2021
Posts: 92

View user's profile Send private message

PostPosted: Thu Mar 02, 2023 10:11 pm     Reply with quote

https://www.ccsinfo.com/forum/viewtopic.php?t=55132

Can I use there example master-slave codes for training using nrf24l01?

Initially, I just want to send a data to blink a led.
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Goto page Previous  1, 2
Page 2 of 2

 
Jump to:  
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