Hi Sayzer,
Yes I found Melanie's thread a while back and I even wrote a short simple program to try and understand it better. I got the program to turn on an led whenever the bits equaled 1 and to shut it off when 0 and with the press of a button the sequence changes but I couldn't figure an application for it in any of my programs. I'd still be interested in hearing Dave's concept as it seems he can see an application that's beyond my comprehension and I'm eager to learn that.
Thanks for your explanation of the eepron and it does make sense to me for that part now. I did read the manual but couldn't make any real sense of it. This is just a hobby for me, I haven't had any courses or schooling on programming or electronics so I take it slowly. Now that I'm semi retired I've started to spend more time with electronics and programming and I find it very rewarding.
Thanks for your help and the links
jessey
Code:
Select_Push_Button VAR PORTB.7 '(pin 40) 1st
Hours_Push_Button VAR PORTD.2 '(pin 21) 2nd
Minutes_Push_Button var PORTB.0 '(pin 33) 3rd
Seconds_Push_Button var PORTB.1 '(pin 34) 4th
Toggle_Push_Button var PORTB.2 '(pin 35) 5th
A VAR BYTE
A = 0
MyWord var word
MyWord = %1010101010101010
MyByte Var word
MyVar var word
MyBit var BIT
Reference_Word VAR WORD
Reference_Word1 VAR WORD
Reference_Word2 VAR WORD
Reference_Word3 VAR WORD
Reference_Word = 1010
Reference_Word1 = 1010
Reference_Word2 = 1010
Reference_Word3 = 1010
Is_Pressed CON 0
GOTO mainloop
Sound_Buzzer:
PWM Buzzer,250,1
RETURN
PAUSE_100:
PAUSE 100
RETURN
mainloop:
Show_Print:
For MyVar=0 to 15
MyBit=MyWord.0(MyVar)
LCDOut $FE,1,"Bit ",DEC MyVar,"=",DEC MyBit
LCDOut $fe,$c0,$fe,$0e,dec Reference_Word,DEC Reference_Word1, _
DEC Reference_Word2,DEC Reference_Word3
if a = 1 then Return_To_Push_Button_1
if a = 2 then Return_To_Push_Button_2
if a = 3 then Return_To_Push_Button_3
if a = 4 then Return_To_Push_Button_4
if a = 5 then Return_To_Push_Button_5
IF MyBit = 1 then
HIGH LED
PAUSE 1000
ELSE
LOW LED
PAUSE 1000
ENDIF
IF Select_Push_Button = Is_Pressed then ' #1
GOSUB Sound_Buzzer : A = 1
MyWord = %1100110011001100
Reference_Word = 1100
Reference_Word1 = 1100
Reference_Word2 = 1100
Reference_Word3 = 1100
MyVar = 0
IF A = 1 THEN Show_Print
Return_To_Puch_Button_1:
A = 0
WHILE Select_Push_Button = Is_Pressed : GOSUB PAUSE_100 : WEND
IF MyVar = 0 THEN MAINLOOP
ENDIF
IF Hours_Push_Button = Is_Pressed then ' #2
GOSUB Sound_Buzzer : A = 2
MyWord = %1110111011101110
Reference_Word = 1110
Reference_Word1 = 1110
Reference_Word2 = 1110
Reference_Word3 = 1110
MyVar = 0
IF A = 2 THEN Show_Print
Return_To_Puch_Button_2:
A = 0
WHILE Hours_Push_Button = Is_Pressed : GOSUB PAUSE_100 : WEND
IF MyVar = 0 THEN MAINLOOP
ENDIF
IF Minutes_Push_Button = Is_Pressed then ' #3
GOSUB Sound_Buzzer : A = 3
MyWord = %1101101111001001
Reference_Word = 1101
Reference_Word1 = 1011
Reference_Word2 = 1100
Reference_Word3 = 1001
MyVar = 0
IF A = 3 THEN Show_Print
Return_To_Puch_Button_3:
A = 0
WHILE Minutes_Push_Button = Is_Pressed : GOSUB PAUSE_100 : WEND
IF MyVar = 0 THEN MAINLOOP
ENDIF
IF Seconds_Push_Button = Is_Pressed then ' #4
GOSUB Sound_Buzzer : A = 4
MyWord = %1010100110101001
Reference_Word = 1010
Reference_Word1 = 1001
Reference_Word2 = 1010
Reference_Word3 = 1001
MyVar = 0
IF A = 4 THEN Show_Print
Return_To_Puch_Button_4:
A = 0
WHILE Seconds_Push_Button = Is_Pressed : GOSUB PAUSE_100 : WEND
IF MyVar = 0 THEN MAINLOOP
ENDIF
IF Toggle_Push_Button = Is_Pressed then ' #5
GOSUB Sound_Buzzer : A = 5
MyWord = %1111101110101101
Reference_Word = 1111
Reference_Word1 = 1011
Reference_Word2 = 1010
Reference_Word3 = 1101
MyVar = 0
IF A = 5 THEN Show_Print
Return_To_Puch_Button_5:
A = 0
WHILE Toggle_Push_Button = Is_Pressed : GOSUB PAUSE_100 : WEND
IF MyVar = 0 THEN MAINLOOP
ENDIF
Next MyVar
GOTO mainloop
end
Bookmarks