movf PORTA, 0 ; Move the value of PORTA in Wcall table ; Call Table routineMOVWF PORTB ; store the returned value in PORTBtable ADDWF PCL, F RETLW <value here> RETLW <value here> RETLW <value here> RETLW <value here> RETLW <value here>
Salamat po sa mga response ninyo... cge po try kong gawin mga suggestions ninyo...sir kaizer thanks sa hint...ireresearch ko nalng yang lookup table...soon il be posting the assembly code... if i hav problems i hope matulungan nyo din po aq...thanks po ulit...cge po til nxt tym... signing off.
repeat: ;start of input checkbtfss PORTA, 0 ;check RA0, skip if high or truegoto repeat ;go back to start if RA0 is zero or falsebtfss PORTA, 2 ;check RA2, skip if high or truegoto repeatbtfss PORTA, 4 ;check RA4, skip if high or truegoto repeatbsf PORTB, 5 ;set RB5 high
repeat:movf PORTA, W ;move value of PORTA to W registerxorlw 15H ;compare 15H to the value of W registerbtfsc STATUS, Z ;check if Zero bit of STATUS register is zero or falsebsf PORTB, 5goto repeat
Just to give you hint:you can use lookup table for here...RETLW kthe returned value will be move in PORTB..say you will have all your PORTA as your input..Code: [Select]movf PORTA, 0 ; Move the value of PORTA in Wcall table ; Call Table routineMOVWF PORTB ; store the returned value in PORTBtable ADDWF PCL, F RETLW <value here> RETLW <value here> RETLW <value here> RETLW <value here> RETLW <value here>this is just a sample lookup table, but it will vary depends on your needs
^based on my code above..assuming PORTA has a value of 2...then it will move in to W register.. then it will call the table..the current Value of W Register will Add to the Program Counter(PCL) and will move towards the Series of RETLW depending on the Value which came from PORTA..then it will return the corresponding literal value you have stated back to the "last" table call.. the return value is stored in W register so that after returning from the table you have to stored it in PORTB to send the Output into it..hope that helps you..need to go home for now.. =)
Gud day po kay sir kaizer..nakuha ko na po ung codes base sa lookuptable...at nagpatulong na lng din po ako sa lab facilitator namin na magaling din sa assembly..Thanks po for helping me out...pogipoints++ for you!...