haqeemnasir
Newbie level 2
Hello everyone, im currently working on my own project. Below is my program. PORTC works fine..but im not sure why PORTA are not working. in this program, when the user press the button(PORTA and PORTC), the BCD 7 segment display will increase by 1. the button are active low. i also attach the schematic diagram..
Code ASM - [expand] 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 #include<p18F4550.inc> k set 0x01 a set 0x02 b set 0x03 c set 0x04 d set 0x05 e set 0x06 f set 0x07 g set 0x08 org 0x00 goto start org 0x08 retfie org 0x18 retfie start clrf TRISD,A setf TRISC,A setf TRISA,A clrf PORTD,A clrf PORTC,A clrf PORTA,A movlw 0x02 movwf a movwf b movwf c movwf d movwf e movwf f movwf g check btfsc PORTC,0,A ;user1 bra here btfss PORTC,0,A bra check call person1 here btfsc PORTC,1,A ;user2 bra check1 btfss PORTC,1,A bra here call person2 check1 btfsc PORTC,2,A ;user3 bra check btfss PORTC,2,A bra check1 call person3 check2 btfsc PORTA,0,A ;user4 bra check btfss PORTA,0,A bra check2 call person4 check3 btfsc PORTA,1,A ;user5 bra check btfss PORTA,1,A bra check3 call person5 check4 btfsc PORTA,2,A ;user6 bra check btfss PORTA,2,A bra check4 call person6 check5 btfsc PORTA,3,A ;user7 bra check btfss PORTA,3,A bra check5 call person7 bra check person1 decfsz a call inc return person2 decfsz b call inc return person3 decfsz c call inc return person4 decfsz d call inc return person5 decfsz e call inc return person6 decfsz f call inc return person7 decfsz g call inc return inc incf k movff k,PORTD return end
Attachments
Last edited by a moderator: