| View previous topic :: View next topic |
| Author |
Message |
Mark
Joined: 07 Sep 2003 Posts: 2838 Location: Atlanta, GA
|
|
Posted: Thu Sep 01, 2005 8:22 am |
|
|
Well if you register, then you can delete or at least edit them. Almost always when posting a large amount of code you will get an error like that. I always copy the text before I submit. If I get an error then I check the post to see if it was posted. Sometimes it might take a minute. If it doesn't get posted, then I might try posting again but I don't recall having to do this ever.
As for your problem, it has already been answered! Say your minutes = 45. If you take the modulus 10 of the number you will get 5. What does that mean, the remainder. If you divide the integer by an integer of 10 you will get 4. Those are your two values.
| Code: |
ones = mins % 10;
tens = mins/10;
|
or
| Code: | tens = mins/10;
ones = mins - tens*10;
|
|
|
 |
Guest
|
|
Posted: Thu Sep 01, 2005 8:51 am |
|
|
How about the initialization problem?
1. I can not initialize both of the ds1307 and max7219, they are
conflict when I run the init_7219(); and the init_ds1307();
function because both use the RC3, RC4 pins. |
|
 |
Mark
Joined: 07 Sep 2003 Posts: 2838 Location: Atlanta, GA
|
|
Posted: Thu Sep 01, 2005 8:55 am |
|
|
| Well I don't have a schematic and haven't looked at the Max7219's datasheet so the easiest answer would be to move the DS1307 to 2 other pins and use software I2C routines |
|
 |
Guest
|
|
Posted: Thu Sep 01, 2005 9:03 am |
|
|
Thank very much..
I will try.. |
|
 |
arunb
Joined: 08 Sep 2003 Posts: 492 Location: India
|
| RE: |
Posted: Sat Sep 03, 2005 4:47 am |
|
|
Hi,
Here is my code for MAX 7219 driver IC, it doesn't use the standard SPI routines
| Code: |
void write_MAX7219_byte(int reg,int data)
{
BYTE i;
output_low(MAX7219_CS);
for (i=0;i<4;i++) //DONT CARE BITS
{
output_low(MAX7219_DIN);
output_high(MAX7219_CLK);
delay_us(700);
output_low(MAX7219_CLK);
delay_us(700);
}
for(i=4; i>0; i--) //ADDRESS REGISTERS
{
output_low(MAX7219_CLK);
if(bit_test(reg,i-1)==0)
output_low(MAX7219_DIN);
else
output_high(MAX7219_DIN);
delay_us(700);
output_high(MAX7219_CLK);
delay_us(700);
}
for(i=8; i>0; i--) //DATA BITS ARE LOADED HERE
{
output_low(MAX7219_CLK);
if(bit_test(data,i-1)==0)
output_low(MAX7219_DIN);
else
output_high(MAX7219_DIN);
delay_us(700);
output_high(MAX7219_CLK);
delay_us(700);
}
output_high(MAX7219_CS);
}
|
To initialise use this..
| Code: |
void initialise_MAX7219()
{
write_MAX7219_byte(0x0B,7); //Scan limit set to 5 digits
write_MAX7219_byte(0x0C,1); //Normal operation
write_MAX7219_byte(0x09,0xFF); // Decode mode on all digits
write_MAX7219_byte(0x0A,0x02); // Set Intensity level
}
|
Thanks
arunb |
|
 |
Guest
|
| add decimal point to any digit ? |
Posted: Sat Jan 26, 2008 12:37 pm |
|
|
How can we add decimal point to any digit ?
as shown on datasheet of MAX7219 , if add 32 to output value it should light up decimal point , but no success..
while(1){
for(i=1;i<=8;i++){
for(j=0;j<=9;j++){
send_16bit(i,j+32); // DIGITO , VALOR+32
delay_ms(200);
}
}
} |
|
 |
|