I’ve been assigned to I/O Programming and I have no idea where to begin. I can’t find any kind of documentation or sample code. Can anyone point me in the right direction?
define I/O programing? do you mean RC I/O or UI I/O?
Hell if I know. My team’s programming mentor came in for five minutes and gave assignments to the programming team and left. All he told me was to do I/O.
well reguardless youll be dealing with lots of ifs
if (dig_in_1 == 1) dothis();
what I would do is write down what you want to control and how you want to control it.
if you could PM me some more specifics I could walk you through the steps and give you some sample code
I already have that. The problem is that I don’t know any of the syntax or how to do anything in MPLAB. God I wish I could us Dev for the programming.
http://www.faqs.org/docs/learnc/
skim over that but fully read the flow control section and the function section.
thanks
Just for the record:
Which IDE you program in has little effect on the required syntax (presuming they are all ANSI standard). Any knowledge in Dev can be applied to MPLAB, i believe.
I/O ( intput / output )
The connections to the real world.
Digital input - on / off signals to the robot controller ( is the switch open or closed )
Digital output - on / off signals from the robot controller
Analog input - signal can vary between 0 and 5 VDC. Controller converts to a numerical value 0 - 4096.
Smart I/O - serial port connection to the camera - bidirectional communcation with another controller.
PWM output - pulse width modulated signal used to control the drive motors and servo motors.
Spike output - high current digital output
So where do you start, go talk with the groups responsible for the drive train and the other mechanisms for your robot. How many motors do they plan on using? Are air cylinders or other pnuematic components going to be used? How will end of travel conditions be detected? (if they don’t know, then you need to get them to design in the required sensors (limit swiches, etc.) )What other sensors are needed? It is much easier to design in the required sensors upfront than to kludge them on at the end. Make a comprehensive list and determine if there are enough of each type of i/o; then make i/o assignments. Publish a document so all other programmers and the electrical wiring team know what connects to what.
Our control system as we envision it.
Joystick #1 - controls the left drive motor
Joystick #2 - controls the right drive motor
3 buttons - preset heights for the lifting arm
=========*Ground
=========*Middle Rack
=========*Top Rack
Switch - open/close clamp via pneumatics system
Lever - controls angle of lifting arm via penchiameter (I know I misspelled it horridly)
Big Red Button - unfolds platform and opens ramp