TM1638 is a bit different than TM1637. It uses 3 communication lines: data, clk, stb.
TM1638 module boards contain 8 x 7seg digits, 8x single Led's, 8x pushbutton switches. The model I am using is model 1, there are 3 other models containing various orientations and number of switches.
This library is about a weeks work of spare time. There is one thing I don't have fullly working and that is the switch inputs. The left 4 switches don't work, it may be a hardware problem but I don't have another module to test on right now. The right 4 switches do scan fine and I included the demo lock program which uses them.
TM_reset - clears all the LED's and 7segs to off. Just writing this realized this should be renamed TM_Clear.
Some of the routines still use the old way of using just the first 4 7seg disp's .
TM_setLED(TMaddr, TMseg2) - turns on or off the individual LED's on the board
TM_display7Seg(TMaddr, TMseg1) - writes your own combination of segments on/off plus decimalpoint to a particular 7seg digit
WriteChar (In TMaddr, In TMchar) - sends a ASCII char to a particular 7seg digit
TMDec ( In TMValue as word, Optional TM1638_Zero as byte = 0)', , Optional TM1638_Colon as byte = 0)
Writes a decimal number 0-9999 in the first 4 7seg digits. it has the option of including leading zeros and the decimal point can be turned on between the 2cd and 3rd digit.
TMHex ( In TMValue as word) - write a hex number in the first 4 digits.
TM_readButtons - returns a button pushed in variable 'buttons'.
TM_Print (In PrintData As String)
TM_Print (In SerPrintVal) -byte
TM_Print (In SerPrintVal As Word)
TM_Print (In SerPrintValInt As Integer)
TM_Print (In SerPrintVal As Long)
All these Prints allow you to write 5 different types of variables to the display. There is no length checking so the programmer must be aware. Also you must decide if you want to write over the top of the previous display or clear it first with TM_Reset.
attached is a zip with the Library and 3 test files.
Hi Chaps, many thanks for the work on TM1638 - I was just about to start a duplicate.
I just loaded the demo and the compiler throws up errors...
Have I done something stupid? - is GCB expecting other comment delimiters?
here is the error log...
makeASM
Great Cow BASIC Pre-processing (Copyright 2007..2019)
Great Cow BASIC (0.98.06 2019-06-12 (Windows 32 bit))
OK, sorry - is it bad form to post clods of text like above? -
I went and fixed TM_readButtons -> TM1638_readButtons
similarly TM_setLED
fewer errors now - and there is an ASM file, so maybe just ignore the errs below? - I will try it.
TM1638 is a bit different than TM1637. It uses 3 communication lines: data, clk, stb.
TM1638 module boards contain 8 x 7seg digits, 8x single Led's, 8x pushbutton switches. The model I am using is model 1, there are 3 other models containing various orientations and number of switches.
This library is about a weeks work of spare time. There is one thing I don't have fullly working and that is the switch inputs. The left 4 switches don't work, it may be a hardware problem but I don't have another module to test on right now. The right 4 switches do scan fine and I included the demo lock program which uses them.
TM_reset - clears all the LED's and 7segs to off. Just writing this realized this should be renamed TM_Clear.
Some of the routines still use the old way of using just the first 4 7seg disp's .
TM_setLED(TMaddr, TMseg2) - turns on or off the individual LED's on the board
TM_display7Seg(TMaddr, TMseg1) - writes your own combination of segments on/off plus decimalpoint to a particular 7seg digit
WriteChar (In TMaddr, In TMchar) - sends a ASCII char to a particular 7seg digit
TMDec ( In TMValue as word, Optional TM1638_Zero as byte = 0)', , Optional TM1638_Colon as byte = 0)
Writes a decimal number 0-9999 in the first 4 7seg digits. it has the option of including leading zeros and the decimal point can be turned on between the 2cd and 3rd digit.
TMHex ( In TMValue as word) - write a hex number in the first 4 digits.
TM_readButtons - returns a button pushed in variable 'buttons'.
TM_Print (In PrintData As String)
TM_Print (In SerPrintVal) -byte
TM_Print (In SerPrintVal As Word)
TM_Print (In SerPrintValInt As Integer)
TM_Print (In SerPrintVal As Long)
All these Prints allow you to write 5 different types of variables to the display. There is no length checking so the programmer must be aware. Also you must decide if you want to write over the top of the previous display or clear it first with TM_Reset.
attached is a zip with the Library and 3 test files.
Have fun!
Merry Xmas
Mike
THANK YOU!
Move into the library?
I can make the Help pages but you will have to correct/edit them!
Evan,
Let us "let the dust settle" and see if anybody (besides me) can test and give comments.
73
Mike w9ys
Mike - ok. Keep your eye on this for a few weeks and remind me in the new year to include etc.
:-)
Hi Chaps, many thanks for the work on TM1638 - I was just about to start a duplicate.
I just loaded the demo and the compiler throws up errors...
Have I done something stupid? - is GCB expecting other comment delimiters?
here is the error log...
makeASM
Great Cow BASIC Pre-processing (Copyright 2007..2019)
Great Cow BASIC (0.98.06 2019-06-12 (Windows 32 bit))
Compiling C:\GCB@Syn\GreatCowBasic\Demos\tm1638\TM1638_keypad_combination_lock_demonstration-16f886.gcb ...
Errors have been found:
TM1638_keypad_combination_lock_demonstration-16f886.gcb (63): Error: Syntax
Error
TM1638_keypad_combination_lock_demonstration-16f886.gcb (64): Error:
Variable BUTTONS was not explicitly declared
TM1638_keypad_combination_lock_demonstration-16f886.gcb (65): Error:
Array/Function TM_SETLED has not been declared
TM1638_keypad_combination_lock_demonstration-16f886.gcb (65): Error: Syntax
Error
TM1638_keypad_combination_lock_demonstration-16f886.gcb (71): Error:
Array/Function TM_SETLED has not been declared
TM1638_keypad_combination_lock_demonstration-16f886.gcb (71): Error: Syntax
Error
TM1638.h (125): Error: Invalid variable name: /STARTUP
TM1638.h (126): Error: Invalid variable name: /BRIGHTNESSMASK
TM1638.h (126): Error: Invalid variable name: /BRIGHTNESSADDRESS
TM1638.h (158): Error: Invalid variable name: /INCREMENTALWRITE
TM1638.h (160): Error: Invalid variable name:
/LEFTMOSTSEGMENTADDRESSC0C2C4C6C8CACCCE
TM1638.h (288): Error: Invalid variable name: /BRIGHTNESSMASK
TM1638.h (288): Error: Invalid variable name: /BRIGHTNESSADDRESS
TM1638.h (300): Error: Invalid variable name: /WRITETOALOCATION
TM1638.h (302): Error: Invalid variable name:
/LEFTMOSTSEGMENTADDRESSC0C2C4C6C8CACCCE
TM1638.h (318): Error: Invalid variable name: /BRIGHTNESSMASK
TM1638.h (318): Error: Invalid variable name: /BRIGHTNESSADDRESS
OK, sorry - is it bad form to post clods of text like above? -
I went and fixed TM_readButtons -> TM1638_readButtons
similarly TM_setLED
fewer errors now - and there is an ASM file, so maybe just ignore the errs below? - I will try it.
just needed to change a few // into '// comment delimiters - works great :) many thanks
foINI
Great Cow BASIC Pre-processing (Copyright 2007..2019)
Search for existing hexFile, compile if hexFile is not found, then program.
Great Cow BASIC (0.98.06 2019-06-12 (Windows 32 bit))
Compiling C:\GCB@Syn\GreatCowBasic\Demos\tm1638\Tm1638_ShortCheckv1089.gcb ...
Search for an existing hexFile, compile if not found, then program
Downloading program ...
PICkit 2 Program Report
16-Mar-2021, 03:12:00
Device Type: PIC16F716
Program Succeeded.
Operation Succeeded
I have included this work in the Demos folders in the release. I have not been able to test but I did ensure the source programs compiled.
Thank you!