Hi Guys & Dolls,
got the DT program running but needed to implement a stupid LCD comment first!
otherwise the lcd shows only rubbish
this is a far cry from my goal but at least a big jump for me, an unbelievable small step for mankind, maybe a step back.....Code:'**************************************************************** * '* Notes : To use this example with MicroCode Studio, you * '* : should: * '* : PIC 16F88 4 MHZ crystal * '* WORKS! ī * '**************************************************************** CMCON = 7 ' Disable analog comparator ANSEL = %00000000 ' set all to digital Include "modedefs.bas" define OSC 4 ' this example uses a 4MHz clock CMCON = 7 ' RA0-RA3 are digital I/O TRISA = 0 ' PORT A is output TRISB = 3 ' RB0 is Input count RB1 Input reset others output Minute var byte ' Define minute variable Second var byte ' Define second variable Ticks var byte ' Define pieces of seconds variable DoUpdate var byte ' Define variable to indicate update clear ' clear all RAM (sets all VAR declarations to zero) DoUpdate = 1 ' Force first display OPTION_REG = %00000101 ' Set TMR0 configuration INTCON = $A0 ' Enable TMR0 interrupts On Interrupt Goto TickInterrupt PAUSE 100 LCDOUT $FE,1,"Guten" pause 2000 LCDOUT $FE,1,"Tag" pause 2000 ' Main program loop MainLoop: if DoUpdate then LCDOUT $FE,1 LCDOUT $FE,1,DEC2 Minute, ":",DEC2 Second DoUpdate = 0 endif Goto MainLoop ' Interrupt routine to handle each timer tick ' Disable interrupts during interrupt handler disable TickInterrupt: Ticks = Ticks + 1 ' Count pieces of seconds If Ticks < 61 Then ExitInterrupt ' 61 ticks per second ' One second elasped - update time Ticks = 0 Second = Second + 1 If Second >= 60 Then Second = 0 Minute = Minute + 1 If Minute >= 60 Then Minute = 0 endif Endif DoUpdate = 1 ' Set update ExitInterrupt: INTCON.2 = 0 ' Reset timer interrupt flag Resume end




Bookmarks