![]() |
Interrupts, limit switches, and IR board
For easyC Pro,
how can u get it, so that when the limit switch is pressed and outputting a 1 to the microcontroller, to stop the motor? Right now I have Set PWM3 to 195 Get Interrupt Set PWM3 to 127 which doesn't even make the motor move, at all.... Also, I would like to know how to use the IR board. I'm guessing you'll have to use the interrupt block, which i don't even know how to use. In the end, I need someone to explain the following: -limit switch, implementing it with easyC -the whole Interrupt block, what it exactly does, how can i make it to control a PWM output - IR board, tho I think if i know how the interrupt block works, I could figure this out on my own |
Re: Interrupts, limit switches, and IR board
An interrupt is just what it says: The processor interrupts what it was doing and does whatever the interrupt routine says until the interrupt is cleared. So, interrupts are usually saved for stuff that happens so quick a normal loop might miss it.
For a limit switch, you don't usually need an interrupt. Same for the IR board. Your loop is something like 26 milliseconds, the IR board puts out a 100 millisecond pulse, that means you can see the IR board signal at least three times before it goes away. If the limit switch is being pressed for less than 26 mSec, maybe use an interrupt, but if not... Just use a digital input, but remember that the input pin is pulled high (+5v weakly inside the RC, so what you need to do is connect the switch to ground on one side and the digital input pin on the other side. Also make sure the digital pin you use is really set up as an INPUT, not an output. (I also read that you need to enable the pull-up resistor, but I don't know enough to explain how, or if). Don |
Re: Interrupts, limit switches, and IR board
Quote:
|
Re: Interrupts, limit switches, and IR board
Quote:
|
Re: Interrupts, limit switches, and IR board
1 Attachment(s)
There are two sources of the pullups - one inside the chip for PORTB pins (digital inputs 1-6), and the other within the IFI black robot controller case for digital inputs 7-18.
See IFI diagram for controller pullup information. Code:
PORTB is a bidirectional I/O port. PORTB can be softwareThe other digital lines 7-18 always have a 100k pullup supplied by IFI whether input or output. The internal PORTB pullups are enabled within the code build environments by default. In IFI file ifi_library.c: Code:
Initialize_Registers()RC Networks effectively act as a time delay for the signal/signal change. Attached is a schematic of a typical limit switch input into the robot controller. |
| All times are GMT -5. The time now is 23:51. |
Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi