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

18F2550 external interrupts

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
eng.mohamedtoumi



Joined: 13 Jan 2018
Posts: 23
Location: Tun

View user's profile Send private message Visit poster's website

18F2550 external interrupts
PostPosted: Fri May 11, 2018 6:28 pm     Reply with quote

hello... I've recently started a 18F2550 project consisting of a line follower robot using 18F2550.
I used 2 pull ups (as the PCM schematic with 4.7k resistor) as line sensors just for the purpose of debugging the code.
The line sensors are on external interrupts and working fine on real PCB (external interrupt is detected whenever i press the button).
Simulation works fine also.
Everything works fine on the pcb without the motors (2 motors each consuming 5v 0.8 A). I used a Bluetooth module to debug the sensors values and they were received correctly, but when i connect the motors the interrupt routine is started automatically even when i don't press the buttons.
PS: I checked the buttons and they are fine also I'm using a 5v 12A power source.
temtronic



Joined: 01 Jul 2010
Posts: 9245
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Fri May 11, 2018 8:12 pm     Reply with quote

Welcome to the 'fun' world of EMI ! It sounds like the motors are generating EMI (noise) and triggering the PIC.
Some possible cures are
1) adding some .1 mfd caps near the VDD/VSS pins of the PIC
2) adding flyback diodes across the motor terminals
3) add a cap across the motor terminals
4) use Google to look for 'motor supression', or similar keywords
5) increase the PCB traces for power lines
6) wiring should be
power source---motors---PCB with PIC
7) add more C to power supply, esp. .1 mfd, .01 mfd (hf filters)

just some of the things you can/need to do.
Jay
eng.mohamedtoumi



Joined: 13 Jan 2018
Posts: 23
Location: Tun

View user's profile Send private message Visit poster's website

PostPosted: Sat May 12, 2018 6:13 am     Reply with quote

Thank you for your response. I will try your solutions. I'll post the results later. Cool Cool
eng.mohamedtoumi



Joined: 13 Jan 2018
Posts: 23
Location: Tun

View user's profile Send private message Visit poster's website

PostPosted: Sat May 12, 2018 9:07 am     Reply with quote

https://www.pololu.com/docs/0J15/9
this solution (connecting 3 cap to the motor) solved my problem Very Happy Smile
temtronic



Joined: 01 Jul 2010
Posts: 9245
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Sat May 12, 2018 9:35 am     Reply with quote

GREAT, happy you got it fixed !!
EMI (noise) can be very hard to locate and suppress, entire books have been written on the subject and a lot of it is a 'black art' !
You may want to add .1 mfd caps to every I/O point (external connection) just to be sure...
Cheers
Jay
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
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