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
 

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 ??
 

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.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…