CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

1Wire and PIC24FV32KA304

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
DerWolf



Joined: 30 Jan 2010
Posts: 8

View user's profile Send private message

1Wire and PIC24FV32KA304
PostPosted: Sat Jan 18, 2014 1:05 pm     Reply with quote

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: 9163
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Sat Jan 18, 2014 1:46 pm     Reply with quote

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

View user's profile Send private message

PostPosted: Sun Jan 19, 2014 12:08 pm     Reply with quote

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

View user's profile Send private message

PostPosted: Sun Jan 19, 2014 3:26 pm     Reply with quote

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

View user's profile Send private message

PostPosted: Mon Jan 20, 2014 4:40 pm     Reply with quote

Thank you it is working now.

regards
A.Wolf
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group