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
C Code in PIC
-
- Posts: 20
- Joined: Mon Apr 24, 2017 3:26 am
- Has thanked: 1 time
- Been thanked: 3 times
- Benj
- Matrix Staff
- Posts: 15312
- Joined: Mon Oct 16, 2006 10:48 am
- Location: Matrix TS Ltd
- Has thanked: 4803 times
- Been thanked: 4314 times
- Contact:
Re: C Code in PIC
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.
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.
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
-
- Posts: 20
- Joined: Mon Apr 24, 2017 3:26 am
- Has thanked: 1 time
- Been thanked: 3 times
Re: C Code in PIC
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.
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.
-
- Posts: 20
- Joined: Mon Apr 24, 2017 3:26 am
- Has thanked: 1 time
- Been thanked: 3 times
Re: C Code in PIC
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
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
- Benj
- Matrix Staff
- Posts: 15312
- Joined: Mon Oct 16, 2006 10:48 am
- Location: Matrix TS Ltd
- Has thanked: 4803 times
- Been thanked: 4314 times
- Contact:
Re: C Code in PIC
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.
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.
Code: Select all
INTCON2 &= 0x7F;
Code: Select all
PORTG |= 0x80;
Code: Select all
PORTG |= 0x40;
Code: Select all
PORTG |= 0x20;
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
-
- Posts: 20
- Joined: Mon Apr 24, 2017 3:26 am
- Has thanked: 1 time
- Been thanked: 3 times