Small Word Clock Kit contains a 12 x 10 LED matrix. Displays the time in letters.
PIC16F887 is used for control, CR1220 is used as the battery for RTC time memory.
Appearance drawings, circuit diagrams, and farms are listed below.https://hackaday.io/project/164406/files
I tried to display images on the LED matrix of the Small Word Clock Kit.
MPLABI programmed using MPLAB X IDE and PIC writer.
Connect the PIC writer to the ICSP connector of Small Word Clock Kit and write.
Party ParrotI made it possible to display the Party Parrot here.
The material (chillparrot.gif) was obtained below. https://cultofthepartyparrot.com/
The gif was decomposed into BMPs and reduced to 12x10 for display on the 12x10 LED matrix of the Small Word Clock Kit.I processed 4 git images into binary and wrote them into the Small Word Clock Kit.
I wrote 4 images to the Small Word Clock Kit.The microcomputer is equipped with PIC16F887 and the memory is 14KB.It's smaller than Arduino UNO (32KB).
CodemyBitmap is the 4 binary data of Party Parrot.
#include <xc.h>
#pragma config WDTE=OFF,PWRTE=OFF,CP=OFF,BOREN=OFF,DEBUG=OFF,FCMEN=OFF
#pragma config LVP=OFF,MCLRE=ON,CPD=OFF,IESO=OFF,FOSC=INTRC_NOCLKOUT
#pragma config BOR4V=BOR21V,WRT=OFF
#define _XTAL_FREQ 8000000
#define P0 RA4 //LED Matrix Anodes (row)
#define P1 RA5
#define P2 RE0
#define P3 RE1
#define P4 RE2
#define P5 RA6
#define P6 RA7
#define P7 RD2
#define P8 RD3
#define P9 RC4
#define N0 RB0 //LED Matrix Cathodes (column)
#define N1 RB1
#define N2 RB2
#define N3 RB3
#define N4 RB4
#define N5 RB5
#define N6 RC5
#define N7 RA3
#define N8 RA2
#define N9 RA1
#define N10 RA0
#define N11 RD0
void delay(long x){ //quick delay function (blocking)
while(x>0){
x--;
}
}
void set_column_IO(unsigned int column){
TRISA=0b00001111;TRISB=0b11111111;TRISC=0b00100000;TRISD=0b00000001; //set all columns to Hi-Z
switch(column){
case 0: //set N0 as output, rest Hi-Z
TRISB0=RB0=0;break;
case 1: //set N1 as output, rest Hi-Z
TRISB1=RB1=0;break;
case 2: //set N2 as output, rest Hi-Z
TRISB2=RB2=0;break;
case 3: //set N3 as output, rest Hi-Z
TRISB3=RB3=0;break;
case 4: //set N4 as output, rest Hi-Z
TRISB4=RB4=0;break;
case 5: //set N5 as output, rest Hi-Z
TRISB5=RB5=0;break;
case 6: //set N6 as output, rest Hi-Z
TRISC5=RC5=0;break; /////////Super important gotcha, columns 6-11 had weird itermittant issue fixed here by rewriting cathodes to 0
case 7: //set N7 as output, rest Hi-Z
TRISA3=RA3=0;break;
case 8: //set N8 as output, rest Hi-Z
TRISA2=RA2=0;break;
case 9: //set N9 as output, rest Hi-Z
TRISA1=RA1=0;break;
case 10: //set N10 as output, rest Hi-Z
TRISA0=RA0=0;break;
case 11: //set N11 as output, rest Hi-Z
TRISD0=RD0=0;break;
}
}
void set_rows(unsigned int row){ //row is 16 bits but only lower 10 bits are used
if(row == 0){
P0=1;
}else if(row == 1){
P1=1;
}else if(row == 2){
P2=1;
}else if(row == 3){
P3=1;
}else if(row == 4){
P4=1;
}else if(row == 5){
P5=1;
}else if(row == 6){
P6=1;
}else if(row == 7){
P7=1;
}else if(row == 8){
P8=1;
}else if(row == 9){
P9=1;
}else{
P0=0;
P1=0;
P2=0;
P3=0;
P4=0;
P5=0;
P6=0;
P7=0;
P8=0;
P9=0;
}
}
int wait = 10;
int brightness = 6;
unsigned int myBitmap [4][10] = {
{0xfff, 0xc3f, 0xc1f, 0x94f, 0x96f, 0x867, 0xae3, 0xb89, 0xbfc, 0x800},
{0xfcf, 0xf93, 0xf83, 0xf2d, 0xe6d, 0xecd, 0xefd, 0xdf1, 0xbfc, 0x000},
{0xfff, 0xfe3, 0xfc1, 0xfc8, 0xf9a, 0xfa7, 0xfa7, 0xe7e, 0xcf8, 0x800},
{0xfff, 0xfff, 0xf8f, 0xf27, 0xf4b, 0xe59, 0xe5d, 0xe99, 0xef0, 0xe00}
};
void main(void) {
OSCCON=0x71; // 8MHz
TRISA=0x00;
TRISB=0xC0;
TRISC=0x00;
TRISD=0x00;
TRISE=0x00;
PORTA=0x00;
PORTB=0x00;
PORTC=0x00;
PORTD=0x00;
PORTE=0x00;
while(1){
for(int frame = 0; frame < 4; frame++){
for(int i = 0; i < wait; i++){
for(int y = 0; y < 10; y++){
int a = 0;
for(int x = 0b1; x <= 0b100000000000; x *=2){
if(!(myBitmap[frame][y] & x)){
set_column_IO(a);
set_rows(y);
}
a++;
}
for(int b = 0; b < brightness; b++){}
set_rows(10);
}
}
}
}
}
OperationThe resolution is 12×10, which is a little rough.
Next to it is the MakePython ESP32 Color LCD.
Return to factory operationA compiled farm fair is up on hackaday.io. word clock.hex
Compiled farms are written with MPLAB X IPE, which is installed with MPLAB X IDE.
Comments