| Swordfish Tutorial - LED |
|
|
| Saturday, 04 April 2009 07:08 | |
|
LED's are great as indicators, and are very easy to interface with. PIC's can produce around 25mA on an output. This is much more than most logic outputs will deliver, and it helps to interface with many devices, especially simple LED's that only require 5mA-20mA usually.
Here's a simple program that will turn an LED on and off twice a second in Swordfish;
Device = 18F4520 Clock = 8 Config OSC = INTIO67 // Use the Internal Oscillator Include "utils.bas" Dim LED As PORTA.0 // Assign an alias for "LED" // Start Of Program... OSCCON = %01111111 // Sets up the internal oscillator SetAllDigital // Make all Pins digital I/O's Low(LED) // Make the LED pin an output and set it low While True LED = 1 // Turn on the LED DelayMS(500) // Delay for half a second LED = 0 // Turn off the LED DelayMS(500) // Delay for half a second Wend
The wiring diagram is as follows (note your will need 5V to pin 1, 11 and 32. GND to 12, 31);
Therefore R = V/I
Then R = 150 ohms
|
|
| Last Updated ( Sunday, 15 November 2009 01:04 ) |
Whos Online
- MrDEB
Forum Activity
simulation program - mrdeb Thursday, 11 March 2010 22:52 - [0 replies]
MARCHING ledS - mrdeb Thursday, 11 March 2010 19:13 - [3 replies]
REALISTIC LED candle flicker - mrdeb Wednesday, 10 March 2010 05:48 - [0 replies]
the LCD demo hello world - mrdeb Wednesday, 10 March 2010 05:41 - [29 replies]
USB problem - jon chandler Tuesday, 09 March 2010 11:31 - [3 replies]
Servo Module - andyo Tuesday, 09 March 2010 03:39 - [3 replies]
pic to ps2 communication - roshan Friday, 05 March 2010 01:30 - [7 replies]




If this wasn't a class project that had to be done on a PIC16F690 u...
I am going to send two data from ADC to USART(async mode) to serial...
I was thinking of battery with powered routers or powered for every...
50 rooms - wow. The XBee modules are very easy to use but I'm not ...
Thanks AndyO. What I have to do is design a device to monitor temp...
The circuit used for the remote sensor can be found here: [url]http...
plz i need help do u know from where i could download it or how cou...
hello everyone i'm trying to finish my final project and i want to ...