kirtan
Junior Member level 2
- Joined
- Mar 11, 2011
- Messages
- 20
- Helped
- 1
- Reputation
- 2
- Reaction score
- 1
- Trophy points
- 1,283
- Activity points
- 1,515
Hello all,
i am working with CS5460 interfaced with ATMega32.
I am observing/facing following behavior /problems. I have not included code of different functions can discuss if required.
1. In CS5460_init_configure() function status and mask registers are cleared, pulse rate register and cyclic count registers are loaded. After loading this values when they are read back I am able to find the loaded values ok as sent on serial port. By this i understand that my read and write routines for CS5460 are working ok (?????).
2.When inputs are not applied to voltage channel and current channels (they are kept open) and the conversion is started in continuous mode I am able to see (on serial port) change in status register value (DRDY bit) for each end of conversions and on reset. Values of V, I and E as read are always a fixed value which are very small values when appropriately converted.
Problem in this is some times the conversion process continuous for 1 min and then starts giving 0 value when any of the register (status or count reg.) are read. By this i understand that serial port may have been out of synchronization but even after sending the reinitializing sequence (SYNC values) the problem is not solve
3. When the inputs are given to voltage and current channel, the chip gives irrelevant values and DRDY bit is never set.
I have read almost all related threads on the forum and tried in my way to identify the problem but enable to find it....kindly help
int main()
{ unsigned long int temp;
unsigned char check;
delay_100ms(50);
int_uart(baud_count);
send_string_uart("welcome \r\n");
delay_100ms(50);
init_spi();
send_string_uart("SPI inialised \r\n");
CS5460_reset();
delay_100ms(50);
send_string_uart("CS5460 reseted \r\n");
CS5460_init_configure();
delay_100ms(50);
send_string_uart("CS5460 initial configured \r\n");
//************for testing*******************
temp = CS5460_read_24bit(REG_CYCLE_COUNT);
send_24bit_uart(temp);
temp=CS5460_read_24bit(REG_STATUS);
send_24bit_uart(temp);
//**********above part is tested ok**************
check =0x41;
CS5460_start_conversion();
while(!(CS5460_DRDY_ready())); //discard the first computation
send_char_uart(check);
check = check +1;
while(1)
{
while(!(CS5460_DRDY_ready()));
temp=CS5460_read_24bit(REG_STATUS);
send_24bit_uart(temp);
Vrms = CS5460_read_24bit(REG_VRMS);
Irms = CS5460_read_24bit(REG_IRMS);
Energy = CS5460_read_24bit(REG_ENERGY);
send_24bit_uart(Vrms);
send_24bit_uart(Irms);
send_24bit_uart(Energy);
send_char_uart(check);
check = check +1;
CS5460_DRDY_reset();
temp=CS5460_read_24bit(REG_STATUS);
send_24bit_uart(temp);
}
while(1);
}
i am working with CS5460 interfaced with ATMega32.
I am observing/facing following behavior /problems. I have not included code of different functions can discuss if required.
1. In CS5460_init_configure() function status and mask registers are cleared, pulse rate register and cyclic count registers are loaded. After loading this values when they are read back I am able to find the loaded values ok as sent on serial port. By this i understand that my read and write routines for CS5460 are working ok (?????).
2.When inputs are not applied to voltage channel and current channels (they are kept open) and the conversion is started in continuous mode I am able to see (on serial port) change in status register value (DRDY bit) for each end of conversions and on reset. Values of V, I and E as read are always a fixed value which are very small values when appropriately converted.
Problem in this is some times the conversion process continuous for 1 min and then starts giving 0 value when any of the register (status or count reg.) are read. By this i understand that serial port may have been out of synchronization but even after sending the reinitializing sequence (SYNC values) the problem is not solve
3. When the inputs are given to voltage and current channel, the chip gives irrelevant values and DRDY bit is never set.
I have read almost all related threads on the forum and tried in my way to identify the problem but enable to find it....kindly help
int main()
{ unsigned long int temp;
unsigned char check;
delay_100ms(50);
int_uart(baud_count);
send_string_uart("welcome \r\n");
delay_100ms(50);
init_spi();
send_string_uart("SPI inialised \r\n");
CS5460_reset();
delay_100ms(50);
send_string_uart("CS5460 reseted \r\n");
CS5460_init_configure();
delay_100ms(50);
send_string_uart("CS5460 initial configured \r\n");
//************for testing*******************
temp = CS5460_read_24bit(REG_CYCLE_COUNT);
send_24bit_uart(temp);
temp=CS5460_read_24bit(REG_STATUS);
send_24bit_uart(temp);
//**********above part is tested ok**************
check =0x41;
CS5460_start_conversion();
while(!(CS5460_DRDY_ready())); //discard the first computation
send_char_uart(check);
check = check +1;
while(1)
{
while(!(CS5460_DRDY_ready()));
temp=CS5460_read_24bit(REG_STATUS);
send_24bit_uart(temp);
Vrms = CS5460_read_24bit(REG_VRMS);
Irms = CS5460_read_24bit(REG_IRMS);
Energy = CS5460_read_24bit(REG_ENERGY);
send_24bit_uart(Vrms);
send_24bit_uart(Irms);
send_24bit_uart(Energy);
send_char_uart(check);
check = check +1;
CS5460_DRDY_reset();
temp=CS5460_read_24bit(REG_STATUS);
send_24bit_uart(temp);
}
while(1);
}