I have a small problem and don't know what to do. I have written a small program with a few screens. When you click on the main menu button you are taken to a screen which displays time.
I have made a loop in the screen to read the time from a pcf8583 and display the time on the screen. Now there is no way back to the main screen. If I try and put a button on the screen nothing happens as the pic does not get to the button software as its busy reading and displaying time. If I try and put the button software in the loop the compiler will not accept it. Any ideas how I can get back to the main screen.
As you can see I have made ButtonRound5 as the button which calls screen4 where the time code is.
Code: Select all
sub procedure ButtonRound5OnClick()
DrawScreen(@Screen4)
loop:
I2C1_Start() ' issue I2C start signal
I2C1_Wr(0xA0) ' send byte via I2C (device address + W)
I2C1_WR(0)
I2C1_Repeated_Start() ' issue I2C signal repeated start
I2C1_Wr(0xA1) ' send byte (device address + R)
dummy = I2C1_rd(1)
dummy = I2C1_rd(1)
seconds = I2C1_Rd(1) ' Read seconds byte
minutes = I2C1_Rd(1) ' Read minutes byte
hours = I2C1_Rd(1) ' Read hours byte
day = I2C1_Rd(1) ' Read year/day byte
month = I2C1_Rd(0) ' Read weekday/month byte}
I2C1_Stop()
month=month << 3
month=month >> 3
Drawbox(@Box1)
dummy=BCD2DEC(seconds)
inttostr(dummy,hold_str)
if dummy<10 then
hold_str[3]="0"
end if
strcpy(Label6_Caption,hold_str)
DrawLabel(@label6)
Drawbox(@Box2)
dummy=BCD2DEC(minutes)
inttostr(dummy,hold_str)
if dummy<10 then
hold_str[3]="0"
end if
strcpy(Label9_Caption,hold_str)
DrawLabel(@label9)
Drawbox(@Box3)
dummy=BCD2DEC(hours)
inttostr(dummy,hold_str)
if dummy<10 then
hold_str[3]="0"
end if
strcpy(Label10_Caption,hold_str)
DrawLabel(@label10)
goto loop
end sub
Thanks in advance.
Anton