Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronic 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.

Register Log in

CCS and the shift_right() function ?

Status
Not open for further replies.

loufoque

Junior Member level 1
Joined
Oct 13, 2001
Messages
17
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
61
shift_right ccs

Hi

Can you help me with the following function.

Void Rx_Temp_16Bits()
{
for (i=0;i<16;++i)
{
set_tris_a (0);
output_low(PIN_A0);
delay_cycles(3);
set_tris_a (1); // 4k7 pullup to PIN_A0
delay_cycles(10); // 10 us moin les 2 us de la lecture
b = input(PIN_A0); // 2 us
shift_right(&Temp_16Bits,2,b);
delay_cycles(60);
output_high(PIN_A0);
set_tris_a (0);
}
}

When i try to run it on my 16f628, Temp_16Bits is always = 0 ?

Thanks in advance for your collaboration.

Loufoque :)
 

trader

Member level 3
Joined
Sep 10, 2002
Messages
66
Helped
1
Reputation
2
Reaction score
1
Trophy points
1,288
Activity points
411
shift_right();

TheTemp_16Bits is always = 0 because the b= input(PIN_A0) is always 0. I don't know why you want to switch the direction of PIN_A0 ??
 

loufoque

Junior Member level 1
Joined
Oct 13, 2001
Messages
17
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
61
It's a loop for reading 16 bits from a remote one wire 18b20 temperature sensor.

After the high to low transition i wait around 10 us and i read the bit sended by the 18b20.

On my scope i can see all the 16 bits !
 

Status
Not open for further replies.
Toggle Sidebar

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Top