Dave
Always wear safety glasses while programming.
Witch manual?And isnt the way I did it before right?
Last edited by osceola; - 25th August 2009 at 12:27.
I create this code,after the model you send me,but just to understand,I would like to know where do I have to make changes -because now is blinking one LED and then 3 LED at time:
Code:'**************************************************************** '* Name : P16F690.INC * '* Author : [ Osceola ] * '* Notice : Copyright (c) 2009 [select VIEW...EDITOR OPTIONS] * '* : All Rights Reserved * '* Date : 25/08/2009 * '* Version : 1.0 * '* Notes : 16F690 DEMO * '* : * '**************************************************************** '16F690 DEMO ' DEFINE OSC 4 OSCCON=%01100000 @ device pic16F690, intrc_osc_noclkout, wdt_on, mclr_on, protect_off TRISC = %00101010 '0 will make the pins an output, 1 will make them inputs 'VARS LED1 VAR PORTC.0 LED2 VAR PORTC.1 LED3 Var PORTC.2 LED4 VAR PORTC.3 START: HIGH LED1 LOW LED2 HIGH LED3 LOW LED4 PAUSE 300 LOW LED1 HIGH LED2 LOW LED3 HIGH LED4 PAUSE 300 PORTC = %00000111 PAUSE 300 HIGH LED1 LOW LED2 HIGH LED3 LOW LED4 PAUSE 300 LOW LED1 HIGH LED2 LOW LED3 HIGH LED4 PORTC = %11100000 GOTO START
And here the LEDs blink in other way:
Code:'**************************************************************** '* Name : P16F690.INC * '* Author : [ Osceola ] * '* Notice : Copyright (c) 2009 [select VIEW...EDITOR OPTIONS] * '* : All Rights Reserved * '* Date : 25/08/2009 * '* Version : 1.0 * '* Notes : 16F690 DEMO * '* : * '**************************************************************** '16F690 DEMO ' DEFINE OSC 4 OSCCON=%01100000 @ device pic16F690, intrc_osc_noclkout, wdt_on, mclr_on, protect_off TRISC = %00101010 '0 will make the pins an output, 1 will make them inputs 'VARS LED1 VAR PORTC.0 LED2 VAR PORTC.1 LED3 Var PORTC.2 LED4 VAR PORTC.3 START: HIGH LED1 LOW LED2 HIGH LED3 LOW LED4 PAUSE 300 LOW LED1 HIGH LED2 LOW LED3 HIGH LED4 PAUSE 300 PORTC = %00000111 PAUSE 300 HIGH LED1 LOW LED2 HIGH LED3 LOW LED4 PAUSE 300 LOW LED1 HIGH LED2 LOW LED3 HIGH LED4 PAUSE 300 PORTC = %11100000 PAUSE 300 GOTO START
What does this do?
The manual you can not find is linked on the page where you got your demo.Code:PORTC = %11100000
This page has samples that you need to work through and understand
http://www.melabs.com/resources/samples.htm#code
Dave
Always wear safety glasses while programming.
I have compiled this and dont know why only 3 LEDs are blinking and the 4th doesnt blink.Could you tell me where I am mistaken,to understand better.Thank you
Code:'**************************************************************** '* Name : P16F690.INC * '* Author : [osceola] * '* Notice : * '* : All Rights Reserved * '* Date : 25/08/2009 * '* Version : 1.0 * '* Notes : * '* : * '**************************************************************** ' PICBASIC PRO program to blink 3 LEDS in sequence ' Define LOADER_USED to allow use of the boot loader. ' This will not affect normal program operation. Define LOADER_USED 1 DEFINE OSC 4 'This is the default setting OSCCON=%01100000 @ device pic16F690, intrc_osc_noclkout, wdt_on, mclr_on, protect_off i Var Byte ' Define loop variable LED1 VAR PORTC.0 LED2 VAR PORTC.1 LED3 Var PORTC.2 LED4 VAR PORTC.3 LEDS Var PORTC TRISC = %00000000 ' Set PORTC to all output mainloop: LEDs = 1 Pause 500 LEDS = 2 Pause 500 LEDS = 3 Pause 500 ' LEDS = 4 Pause 500 ' Delay for .5 seconds For i = 1 To 4 ' Go through For..Next loop 2 times LEDS = LEDS << 1 ' Shift on LED one to left Pause 500 ' Delay for .5 seconds Next i Goto mainloop ' Go back to mainloop and blink LED forever End
Bookmarks