untested . . .
Code:PortA = %00000000 TrisA = %00000000 i var byte Start: PortA.1 = 1 while PortA.1 = 1 For i = 0 to 5 portA.0 = 1 pause 500 PortA.0 = 0 pause 500 next i portA.1 = 0 wend end
untested . . .
Code:PortA = %00000000 TrisA = %00000000 i var byte Start: PortA.1 = 1 while PortA.1 = 1 For i = 0 to 5 portA.0 = 1 pause 500 PortA.0 = 0 pause 500 next i portA.1 = 0 wend end
If you do not believe in MAGIC, Consider how currency has value simply by printing it, and is then traded for real assets.
.
Gold is the money of kings, silver is the money of gentlemen, barter is the money of peasants - but debt is the money of slaves
.
There simply is no "Happy Spam" If you do it you will disappear from this forum.
I know, wrong chip and wrong pins... it is what I have on the bench...
Code:'18F6680'07/14/09'BLINKY DEFINE OSC 20 @ __CONFIG _CONFIG1H, _OSC_HS_1H @ __CONFIG _CONFIG2H, _WDT_ON_2H & _WDTPS_128_2H @ __CONFIG _CONFIG4L, _LVP_OFF_4L CNT VAR BYTE FIRST6:HIGH PORTB.2 'SLOW FOR CNT = 1 TO 60:TOGGLE PORTG.4:PAUSE 100 NEXT CNT:LOW PORTB.2:PAUSE 500:GOTO SECOND6 SECOND6:HIGH PORTB.2 'FAST BLINK--REALLY FAST PWM PORTG.4,5,6000 LOW PORTB.2:PAUSE 500:GOTO [color=#0000FF][b]FIRST6
Last edited by mackrackit; - 8th April 2011 at 07:11. Reason: HTML to BB
Dave
Always wear safety glasses while programming.
Here my contribution.Code:PortA = 0 TrisA = 0 Seconds var Byte LED_1 var PortA.0 LED_2 var PortA.1 Loop: 'Your gosub comand goes here Goto Loop Blink: High Led_1 Seconds = 0 While Seconds <>5 High Led_2 pause 500 Low Led_2 pause 500 Seconds = Seconds + 1 wend Low Led_1 Return End
Al.
All progress began with an idea
PORTA = %00000000 read this as PORTA gets bits 00000000
This means, write 0 to each bit position of PORTA. Each 0 represents the bits in PORTA from bit 7 to bit 0. You could also write it as
PORTA = $00 read this as PortA gets Hex 0
TRISA = %00000000
This is the tristate register which tells your PIC to allow the values of PORTA to 'drive' the external world circuits. Same as above for the bit position part. If you set any 1 position to 1, that position will only be able to read (INPUT) from the external circuit.
Clear now? Don't hesitate to ask. See how many responses you got.
I am looking for a way to change the rate of blink (Blinking rate) using Interrupt. I would read a POT using ADC and then change the blink rate, Any idea how I could impliment it in Sayzer's code.
Thanks.
p.s. maybe using TMR0
Cause, I want to use it in a code where I am doing some other things like reading ADC channel , and monitoring inputs , while the led is blinking.
Thanks
You may want to look at this. Post #2 might be of interest.
http://www.picbasic.co.uk/forum/showthread.php?t=3251
Dave
Always wear safety glasses while programming.
Bookmarks