View previous topic :: View next topic |
Author |
Message |
DerWolf
Joined: 30 Jan 2010 Posts: 8
|
1Wire and PIC24FV32KA304 |
Posted: Sat Jan 18, 2014 1:05 pm |
|
|
Hello,
I am trying to use a 1Wire Bus on a PIC24FV32KA304 with 16MHz (internal) on PIN_C3. I have successfully used the one wire code already with a PIC18F4523 with 10MHz on PIN_D0. The same code (changing the PINs of course) is not running on the PIC24. The one wire bus is connected to Pin C3 and using a 4KOhm resistor to +5V.
I wrote a small dummy program just waiting 10 sec. after starting then setting the pin C3 low and after 10 sec. high waiting for a other 10 sec. Using a Voltmeter and measuring the 1wire bus against ground showed the first 10 sec. 0V then 5V but after setting it again it did not return to 0V.
thanx
A. Wolf |
|
|
temtronic
Joined: 01 Jul 2010 Posts: 9229 Location: Greensville,Ontario
|
|
Posted: Sat Jan 18, 2014 1:46 pm |
|
|
While I don't use the 24 series PIC and haven't seen your code, have you disabled any/all peripherals(UARTs,PWM,ADC) that are on your C3 pin? Is it a 'programmable' pin not configured correctly ?
hth
jay |
|
|
DerWolf
Joined: 30 Jan 2010 Posts: 8
|
|
Posted: Sun Jan 19, 2014 12:08 pm |
|
|
Hello,
Everything should be fine with the configuration. I can't find the reason.
regards
A. Wolf
Code: |
#FUSES NOWDT
#FUSES CKSFSM
#FUSES NOBROWNOUT
#FUSES FRC_PLL
#device ICSP=1
#use delay(clock = 16MHZ)
#use STANDARD_IO( C )
#use FIXED_IO( A_outputs=PIN_A3,PIN_A2,PIN_A1,PIN_A0 )
#use FIXED_IO( C_outputs=PIN_C8 )
#define IO_1Wire PIN_C3
#use rs232(UART1, baud=115200, stream=UART_PORT1)
set_tris_c(0b0010000000);
delay_ms(10000);
output_low(IO_1Wire);
delay_ms(10000);
output_high(IO_1Wire);
delay_ms(10000);
output_float(IO_1Wire);
delay_ms(10000); |
|
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Sun Jan 19, 2014 3:26 pm |
|
|
Quote: | I wrote a small dummy program just waiting 10 sec. after starting then
setting the pin C3 low and after 10 sec. high waiting for a other 10 sec.
Using a Voltmeter and measuring the 1wire bus against ground showed
the first 10 sec. 0V then 5V but after setting it again it did not return to 0V.
#use FIXED_IO( C_outputs=PIN_C8 ) |
Get rid of the fixed_io line, then it has a chance to work. You are
sabotaging your program with the fixed_io line. |
|
|
DerWolf
Joined: 30 Jan 2010 Posts: 8
|
|
Posted: Mon Jan 20, 2014 4:40 pm |
|
|
Thank you it is working now.
regards
A.Wolf |
|
|
|