Difference between revisions of "Sample code for most PIC18F4520 operations"

From Mech
Jump to navigationJump to search
Line 1: Line 1:
These will/should also have wiki pages for background and associated electronics:
These will/should also have wiki pages for background and associated electronics:
<li> [http://129.105.69.13/pic/CodeSamples/DigitalIO Digital input and output bit-by-bit or byte-by-byte]
<li>DigitalIO Digital input and output bit-by-bit or byte-by-byte
<li> [http://129.105.69.13/pic/CodeSamples/AnalogInput Reading up to twelve Analog Inputs]
<li>AnalogInput Reading up to twelve Analog Inputs
<li> [http://129.105.69.13/pic/CodeSamples/Counter0 Counting pulses with Timer0]
<li>Counter0 Counting pulses with Timer0
<li> [http://129.105.69.13/pic/CodeSamples/Counter1 Counting pulses with Timer1]
<li>Counter1 Counting pulses with Timer1
<li> [http://129.105.69.13/pic/CodeSamples/MotorPWM PWM outputs for torque control of one or two DC motors; Timer 2]
<li>MotorPWM PWM outputs for torque control of one or two DC motors; Timer 2
<li> [http://129.105.69.13/pic/CodeSamples/RS232com Serial RS232 communication between PIC and a text window]
<li>RS232com Serial RS232 communication between PIC and a text window
<li> [http://129.105.69.13/pic/CodeSamples/Interrupt0 Periodic servo cycles using interrupt routines, 10mS & slower; Timer 0]
<li>Interrupt0 Periodic servo cycles using interrupt routines, 10mS & slower; Timer 0
<li> [http://129.105.69.13/pic/CodeSamples/Interrupt2 Periodic servo cycles using interrupt routines; 10mS & faster; Timer 2]
<li>Interrupt2 Periodic servo cycles using interrupt routines; 10mS & faster; Timer 2
<li> [http://129.105.69.13/pic/CodeSamples/InterruptExternal Interrupts generated by an external pulse]
<li>InterruptExternal Interrupts generated by an external pulse
<li> [http://129.105.69.13/pic/CodeSamples/RCservoSoft PWM output in software for position control of up to five RC servos; Timer 3]
<li>RCservoSoft PWM output in software for position control of up to five RC servos; Timer 3
<li> [http://129.105.69.13/pic/CodeSamples/RCservoHard PWM output in hardware for position control of up to two RC servos; Timer 2]
<li>RCservoHard PWM output in hardware for position control of up to two RC servos; Timer 2
<li> [http://129.105.69.13/pic/CodeSamples/QuadratureSoft Quadrature decoder/counter in software for arbitarily many encoders; 1KHz max]
<li>QuadratureSoft Quadrature decoder/counter in software for arbitarily many encoders; 1KHz max
<li> [http://129.105.69.13/pic/CodeSamples/QuadratureHard Quadrature decoder/counter in hardware for one arbitrarily fast encoder; Timers 0 and 1]
<li>QuadratureHard Quadrature decoder/counter in hardware for one arbitrarily fast encoder; Timers 0 and 1
<br>
<br>
<p>
<p>
Not available yet:
Not available yet:
<li> [http://129.105.69.13/pic/CodeSamples/AnalogOutputParallel Analog output using 8 digital lines]
<li>AnalogOutputParallel Analog output using 8 digital lines
<li> [http://129.105.69.13/pic/CodeSamples/AnalogOutputI2C Analog output using I2C serial]
<li>AnalogOutputI2C Analog output using I2C serial
<li> Printing to a serial LCD
<li> Printing to a serial LCD
<li> Printing to a parallel LCD
<li> Printing to a parallel LCD

Revision as of 14:49, 16 January 2008

These will/should also have wiki pages for background and associated electronics:

  • DigitalIO Digital input and output bit-by-bit or byte-by-byte
  • AnalogInput Reading up to twelve Analog Inputs
  • Counter0 Counting pulses with Timer0
  • Counter1 Counting pulses with Timer1
  • MotorPWM PWM outputs for torque control of one or two DC motors; Timer 2
  • RS232com Serial RS232 communication between PIC and a text window
  • Interrupt0 Periodic servo cycles using interrupt routines, 10mS & slower; Timer 0
  • Interrupt2 Periodic servo cycles using interrupt routines; 10mS & faster; Timer 2
  • InterruptExternal Interrupts generated by an external pulse
  • RCservoSoft PWM output in software for position control of up to five RC servos; Timer 3
  • RCservoHard PWM output in hardware for position control of up to two RC servos; Timer 2
  • QuadratureSoft Quadrature decoder/counter in software for arbitarily many encoders; 1KHz max
  • QuadratureHard Quadrature decoder/counter in hardware for one arbitrarily fast encoder; Timers 0 and 1

    Not available yet:

  • AnalogOutputParallel Analog output using 8 digital lines
  • AnalogOutputI2C Analog output using I2C serial
  • Printing to a serial LCD
  • Printing to a parallel LCD
  • PIC-to-PIC communication
  • Zigbee radio communication
  • Modulated IR communication
  • Strobing LEDs or IREDs for better range and immunity to background light
  • I2C communication
  • CAN bus
  • Capturing data to Matlab
  • Running stepper motors