Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

sa9904b problems and solutions

Status
Not open for further replies.

zia

Full Member level 5
Full Member level 5
Joined
Sep 24, 2010
Messages
284
Helped
27
Reputation
54
Reaction score
26
Trophy points
1,318
Location
Islamabad Pakistan
Visit site
Activity points
2,746
i want to share my sames sa9904bsome code for your help
get data by this way
#define CS PORTD.F2 // or any other pin for spi chip selection
long read_reg(char adr)
{
long x=0;
char d1=0,d2=0,d3=0;
CS = 1;
Spi_Write(1);
Spi_Write(adr | 0x80);
d1=Spi_Read(0);
d2=Spi_Read(0);
d3=Spi_Read(0);
CS = 0;
l1 = d3*65536 + d2 *256 +d1;
return l1;
}
void main(void)
{
Spi_Init_Advanced(MASTER_OSC_DIV64, DATA_SAMPLE_MIDDLE, CLK_IDLE_LOW, HIGH_2_LOW);
TRISD.F2 = 0; // CS output
CS = 0;
for(;;)
{
active_power_count=read_reg(0);
ractive_power_count=read_reg(0);
freq=read_reg(0);
voltage=read_reg(0);
///process all of these according to datasheet
}
}
 
Last edited:

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top