Page 1 of 1
C Code in PIC
Posted: Mon Apr 24, 2017 4:12 am
by allenkkwong
Hi Benj,
I am new to FC6. Recently I have also upgraded to FC7. I put below C code in the main() intended to set the port pulled high internally.
LATG |= 0xc0;
However, after compilation and tested the hardware, the port is not pulled high. Can you tell if I made any mistakes?
Thanks a lot
Allen
Re: C Code in PIC
Posted: Mon Apr 24, 2017 10:25 am
by Benj
Hi Allen,
What chip are you using?
When you say pulled high do you want to output high or simply pull up high using the internal pull up resistors?
The output high will give you 20mA of pull, the internal pull up's will give you significantly less that this in terms of current.
Re: C Code in PIC
Posted: Tue Apr 25, 2017 9:41 am
by allenkkwong
Hi Benj,
I am using PIC18F67J111. I want to simply pull high using the internal pull up resistors.
For the current, I understand this. I do not need high current.
Thanks.
Re: C Code in PIC
Posted: Tue Apr 25, 2017 10:46 am
by allenkkwong
Hi Benj,
I am using PIC18F67J111 and want to use the internal pull resistor.
I do not need high current and understand that the current is less than 20mA which is far more than required.
Thanks
Re: C Code in PIC
Posted: Tue Apr 25, 2017 12:26 pm
by Benj
Hello,
The following applies to the PIC18F67J11 device family and Flowcode 7. The Weak pull up is usually something like 100K Ohm though this can vary from one device family to the next. 80uA - 400uA specified in the datasheet.
To enable PortB pullups.
To enable PortD pullups.
To enable PortE pullups.
To enable PortJ pullups.
Re: C Code in PIC
Posted: Mon May 29, 2017 4:41 am
by allenkkwong
Hi Benj,
Thanks and it works.
Rgds