tulong po.. meron ako nakuhang sample sa mikroe na code at circuit.. nagbuild naman sya sa mikrobasic. nung simulate ko na sa proteus ok din naman. pero nung try ko na sa actual, mali ang output nya. wala naman ako iniba sa sample code..
may project kasi kami, sa code na to ako nag base ng nagawa ko.. ok din sya sa proteus. ayaw gumana ng maayos sa actual kaya ang ginawa ko, yung sample code from microe muna try ko burn sa pic. kaya naman pala ayaw nung project ko, di gumagana yung pinagbasehan ko. pano po ba ito?
eto yung sample code.. supposedly, 83 ang output. 83 nakikita sa proteus. pero sa actual 7segment, 88.
program seven_seg_twodigits
dim v as byte
dim por1 as byte
dim por2 as byte
sub procedure interrupt
'begin
if v = 0 then
PORTB = por2 ' Send mask of tens to PORTB
PORTA = 1 ' Turn on 1st 7seg, turn off 2nd
v = 1
else
PORTB = por1 ' Send mask of ones to PORTB
PORTA = 2 ' Turn on 2nd 7seg, turn off 1st
v = 0
end if
TMR0 = 0 ' Clear TMRO
INTCON = $20 ' Clear TMR0IF and set TMR0IE
end sub
main:
OPTION_REG = $80 ' Pull-up resistors
TRISA = 0 ' PORTA is output
TRISB = 0 ' PORTB is output
PORTB = 0 ' Clear PORTB (make sure LEDs are off)
PORTA = 0 ' Clear PORTA (make sure both displays are off)
TMR0 = 0 ' Clear TMRO
por1 = $7F ' Mask for '8' (check the table above)
por2 = $4F ' Mask for '3' (check the table above)
INTCON = $A0 ' Enable T0IE
while true ' Endless loop, wait for interrupt
nop
wend
end.