I'm using a LTM-8647AHR display to tell the time in 12 hour format, with hours minutes and seconds. It's not lighting up any segments however. Hardware isn't an issue as far as I and another friend can tell. On the scope, I couldn't see any pulse, but it's an analog scope so not sure if I should've. Below is the code, the schematic, and above is a link to the datasheet download mirrors.
Uses a 317 for the 3.3V rail, and a 7805 for the 5 volt rail. Bypass caps on the input and output of both regulators. Both are fed by a 9 VDC 2 A Wall wart, and all display IC's are getting voltage to the supply pins.
#define SECS_CS 46
#define MINS_CS 44
#define HOURS_CS 42
#define SDATA 22
#define SCLK 30
#define PPS 26
#define DP1 0x10000000
#define DP2 0x20000000
void setup(void)
{
pinMode(SECS_CS,OUTPUT);
pinMode(MINS_CS,OUTPUT);
pinMode(HOURS_CS,OUTPUT);
pinMode(SDATA,OUTPUT);
pinMode(SCLK,OUTPUT);
pinMode(PPS,INPUT);
digitalWrite(SECS_CS,1);
digitalWrite(MINS_CS,1);
digitalWrite(HOURS_CS,1);
digitalWrite(SDATA,0);
digitalWrite(SCLK,0);
}
void loop()
{
unsigned char secs=0;
unsigned char mins=0;
unsigned char hours=12;
unsigned char ampm=0;
int i;
long seg;
long segments[]={
0x200FC03F,
0x200FC006,
0x200FC0DB,
0x200FC0CF,
0x200FC0E6,
0x200FC0ED,
0x200FC0FD,
0x200FC007,
0x200FC0FF,
0x200FC0E7,
0x2001803F,
0x20018006,
0x200180DB,
0x200180CF,
0x200180E6,
0x200180ED,
0x200180FD,
0x20018007,
0x200180FF,
0x200180E7,
0x2036C006,
0x2036C0DB,
0x2036C0CF,
0x2036C0E6,
0x2036C0ED,
0x2036C0FD,
0x2036C007,
0x2036C0FF,
0x2036C0E7,
0x2036C006,
0x2033C03F,
0x2033C006,
0x2033C0DB,
0x2033C0CF,
0x2033C0E6,
0x2033C0ED,
0x2033C0FD,
0x2033C007,
0x2033C0FF,
0x2033C0E7,
0x2039803F,
0x20398006,
0x203980DB,
0x203980CF,
0x203980E6,
0x203980ED,
0x203980FD,
0x20398007,
0x203980FF,
0x203980E7,
0x203B403F,
0x203B4006,
0x203B40DB,
0x203B40CF,
0x203B40E6,
0x203B40ED,
0x203B40FD,
0x203B4007,
0x203B40FF,
0x203B40E7
};
{
/* while(digitalRead(PPS)) ; */
delay(999);
if(++secs>59)
{
secs=0;
if(++mins>59)
{
mins=0;
if(++hours>12)
{
hours=1;
ampm^=1;
}
}
}
seg=(ampm)? segments[secs] : (segments[secs]&~(DP2)); //turn off dp2 if ampm==0 (AM)
writeLED(seg,SECS_CS);
writeLED(segments[mins],MINS_CS);
writeLED(segments[hours],HOURS_CS);
}
return(0);
}
void writeLED(long segword, int cs)
{
int i;
digitalWrite(cs,0); //assert chip select
digitalWrite(SCLK,0);
digitalWrite(SDATA,1); //start bit
digitalWrite(SCLK,1);
digitalWrite(SCLK,0);
for(i=1; i!=0; i<<=1)
{
if(segword&i) digitalWrite(SDATA,1);
else digitalWrite(SDATA,0);
digitalWrite(SCLK,1);
digitalWrite(SCLK,0);
}
digitalWrite(SDATA,0);
for(i=0;i<4;i++)
{
digitalWrite(SCLK,1);
digitalWrite(SCLK,0);
}
digitalWrite(cs,1); //chip select off
return;
}
Code used, no errors when compiled.
I'm just trying to get it to put out the time in hours, minutes, and seconds starting at 12:00:00 for now.
Thanks for any help that can be offered.