yugal
Junior Member level 2
- Joined
- Mar 17, 2007
- Messages
- 20
- Helped
- 0
- Reputation
- 0
- Reaction score
- 0
- Trophy points
- 1,281
- Location
- Usa
- Activity points
- 1,418
hi
am new to micro controller
this is my first code but not working . please help to correct this
'***************************************************************
'* Name : Matrix-A.BAS
'* Author : Y.K.SHARMA
'* Date : 4/18/2013
'* Version : 1.0
'* Notes : Ic pic16F676 COMPILIER PBP2.60
'***************************************************************
@ DEVICE pic16F676
@ DEVICE pic16F676, WDT_OFF
@ DEVICE pic16F676, PWRT_ON
@ DEVICE pic16F676, PROTECT_ON
@ DEVICE pic16F676, MCLR_OFF
@ DEVICE pic16F676, INTRC_OSC_NOCLKOUT
'***********************************************
TRISA = %011000
TRISC = %000000
SEQ VAR BYTE
'***********************************************
LED1 VAR PORTC.0
LED2 VAR PORTC.1
LED3 VAR PORTC.2
LED4 VAR PORTC.3
LED5 VAR PORTC.4
LED6 VAR PORTC.5
LED7 VAR PORTA.0
LED8 VAR PORTA.1
LED9 VAR PORTA.2
LED10 VAR PORTA.5
PBUP VAR PORTA.3
PBDN VAR PORTA.4
SEQ = 4
PORTC = 0
PORTA = 0
CMCON = 7
ANSEL = 0
'***************************************
LOOP:
IF PBUP = 0 THEN UPP
IF PBDN = 0 THEN DNN
PAUSE 50
GOSUB ACTIONS:
GOTO LOOP
'**************************
UPP:
IF SEQ = 1 THEN RRT
SEQ = SEQ + 1
PAUSE 50
GOTO RRT
DNN:
IF SEQ = 7 THEN RRT
SEQ = SEQ - 1
PAUSE 50
RRT : RETURN
'*******************************************
ACTIONS:
IF SEQ = 1 THEN
LED1 = 1 :LED2 = 0 :LED3 = 0 :LED4 = 0 :LED5 = 0 :LED6 = 0 :
LED7 = 0 :LED8 = 0 :LED9 = 1 :LED10 = 1 :
ENDIF
IF SEQ = 2 THEN
LED1 = 0 :LED2 = 1 :LED3 = 0 :LED4 = 0 :LED5 = 0 :LED6 = 0 :
LED7 = 0 :LED8 = 1 :LED9 = 0 :LED10 = 1 :
ENDIF
IF SEQ = 3 THEN
LED1 = 0 :LED2 = 0 :LED3 = 1 :LED4 = 0 :LED5 = 0 :LED6 = 0 :
LED7 = 0 :LED8 = 1 :LED9 = 1 :LED10 = 0 :
ENDIF
IF SEQ = 4 THEN
LED1 = 0 :LED2 = 0 :LED3 = 0 :LED4 = 1 :LED5 = 0 :LED6 = 0 :
LED7 = 0 :LED8 = 0 :LED9 = 1 :LED10 = 1 :
ENDIF
IF SEQ = 5 THEN
LED1 = 0 :LED2 = 0 :LED3 = 0 :LED4 = 0 :LED5 = 1 :LED6 = 0 :
LED7 = 0 :LED8 = 0 :LED9 = 1 :LED10 = 1 :
ENDIF
IF SEQ = 6 THEN
LED1 = 0: LED2 = 0:LED3 = 0 :LED4 = 0 :LED5 = 0 :LED6 = 1 :
LED7 = 0 :LED8 = 1 :LED9 = 1 :LED10 = 0 :
ENDIF
IF SEQ = 7 THEN
LED1 = 0 :LED2 = 0 :LED3 = 0 :LED4 = 0 :LED5 = 0 :LED6 = 0 :
LED7 = 1 :LED8 = 0 :LED9 = 1 :LED10 = 1 :
ENDIF
PAUSE 50
RETURN
'***************************************************************
am new to micro controller
this is my first code but not working . please help to correct this
'***************************************************************
'* Name : Matrix-A.BAS
'* Author : Y.K.SHARMA
'* Date : 4/18/2013
'* Version : 1.0
'* Notes : Ic pic16F676 COMPILIER PBP2.60
'***************************************************************
@ DEVICE pic16F676
@ DEVICE pic16F676, WDT_OFF
@ DEVICE pic16F676, PWRT_ON
@ DEVICE pic16F676, PROTECT_ON
@ DEVICE pic16F676, MCLR_OFF
@ DEVICE pic16F676, INTRC_OSC_NOCLKOUT
'***********************************************
TRISA = %011000
TRISC = %000000
SEQ VAR BYTE
'***********************************************
LED1 VAR PORTC.0
LED2 VAR PORTC.1
LED3 VAR PORTC.2
LED4 VAR PORTC.3
LED5 VAR PORTC.4
LED6 VAR PORTC.5
LED7 VAR PORTA.0
LED8 VAR PORTA.1
LED9 VAR PORTA.2
LED10 VAR PORTA.5
PBUP VAR PORTA.3
PBDN VAR PORTA.4
SEQ = 4
PORTC = 0
PORTA = 0
CMCON = 7
ANSEL = 0
'***************************************
LOOP:
IF PBUP = 0 THEN UPP
IF PBDN = 0 THEN DNN
PAUSE 50
GOSUB ACTIONS:
GOTO LOOP
'**************************
UPP:
IF SEQ = 1 THEN RRT
SEQ = SEQ + 1
PAUSE 50
GOTO RRT
DNN:
IF SEQ = 7 THEN RRT
SEQ = SEQ - 1
PAUSE 50
RRT : RETURN
'*******************************************
ACTIONS:
IF SEQ = 1 THEN
LED1 = 1 :LED2 = 0 :LED3 = 0 :LED4 = 0 :LED5 = 0 :LED6 = 0 :
LED7 = 0 :LED8 = 0 :LED9 = 1 :LED10 = 1 :
ENDIF
IF SEQ = 2 THEN
LED1 = 0 :LED2 = 1 :LED3 = 0 :LED4 = 0 :LED5 = 0 :LED6 = 0 :
LED7 = 0 :LED8 = 1 :LED9 = 0 :LED10 = 1 :
ENDIF
IF SEQ = 3 THEN
LED1 = 0 :LED2 = 0 :LED3 = 1 :LED4 = 0 :LED5 = 0 :LED6 = 0 :
LED7 = 0 :LED8 = 1 :LED9 = 1 :LED10 = 0 :
ENDIF
IF SEQ = 4 THEN
LED1 = 0 :LED2 = 0 :LED3 = 0 :LED4 = 1 :LED5 = 0 :LED6 = 0 :
LED7 = 0 :LED8 = 0 :LED9 = 1 :LED10 = 1 :
ENDIF
IF SEQ = 5 THEN
LED1 = 0 :LED2 = 0 :LED3 = 0 :LED4 = 0 :LED5 = 1 :LED6 = 0 :
LED7 = 0 :LED8 = 0 :LED9 = 1 :LED10 = 1 :
ENDIF
IF SEQ = 6 THEN
LED1 = 0: LED2 = 0:LED3 = 0 :LED4 = 0 :LED5 = 0 :LED6 = 1 :
LED7 = 0 :LED8 = 1 :LED9 = 1 :LED10 = 0 :
ENDIF
IF SEQ = 7 THEN
LED1 = 0 :LED2 = 0 :LED3 = 0 :LED4 = 0 :LED5 = 0 :LED6 = 0 :
LED7 = 1 :LED8 = 0 :LED9 = 1 :LED10 = 1 :
ENDIF
PAUSE 50
RETURN
'***************************************************************