Quantcast
Channel: Question and Answer » programming
Viewing all articles
Browse latest Browse all 103

About reading registers of STC3100

$
0
0

I am writing my code for stc31oo registers in C language and i am facing while reading the current registers that how to read these.
i wrote this program for REG_CURRENT_LOW AND REG_CURRENT_HIGH

start_bit();
    send_byte(0b11100001);  // slave address for STC3100
    send_byte(0b11100110);  // reg adress for bat current value reg 
    rep_start_bit();
    send_byte(0b11100001);  // slave address for STC3100
    send_byte(0b00000000);   // to read first 8 bits msb
    BatCurrent2= receive_byte();
    send_ack();
    send_byte(0b00000000);  // to read first 8 bits lsb
    BatCurrent1= receive_byte();
    send_not_ack();
    stop_bit();

the confusion is that do i need to define the reg address to read lsb 8 bits or not?


Viewing all articles
Browse latest Browse all 103