View previous topic :: View next topic |
Author |
Message |
info@ckmintech.com
Joined: 16 May 2006 Posts: 39
|
P1C18F1320 & RS232 |
Posted: Tue May 16, 2006 7:20 pm |
|
|
I am green in MCU programming.
A RS232 interface LT1280 on/off pin is connected to PIC18F1320 RB3/P1A/CCP1. I need to set RB3 to high to enable the LT1280. I used
output_high(PIN_B3);
the pin did not set to 5V, it was stay at around 1.18V. I believe I need to specify RB3 is used for digitial. Am I correct?
Please help.
Thanks |
|
|
carmarmu
Joined: 09 May 2006 Posts: 15 Location: Valencia (Spain)
|
|
Posted: Wed May 17, 2006 12:16 am |
|
|
You must initialize TRISB (like input or output), and you must indicate to the compiler if the port is analogical or digital, since that port is shared (can act like digital line or input for AD converter).
For example, for all TRISB digital output, you can write:
Setup_adc_ports(NO_ANALOGS);
Set_Tris_B(0x00);
Luck!! _________________ **CaRmArMu** Valencia (Spain) |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Wed May 17, 2006 12:47 am |
|
|
Try the program below. I compiled it with PCH vs. 3.249 and the .LST
looks OK.
I'm assuming you're running the PIC at +5v. When you run this
program, Pin B3 should go to +5v. Does it ? If not, then disconnect
any external circuits from Pin B3 and try it again. What's the result ?
If it still doesn't work, try a different pin (such as pin B2). Also, post
your compiler version.
Code: |
#include <18F1320.h>
#fuses INTRC_IO, NOWDT, NOPROTECT, NOBROWNOUT, PUT, NOLVP
#use delay(clock=8000000)
void main(void)
{
output_high(PIN_B3);
while(1);
}
|
|
|
|
Storic
Joined: 03 Dec 2005 Posts: 182 Location: Australia SA
|
|
Posted: Wed May 17, 2006 12:49 am |
|
|
Recheck your output/ PIN-B3
the PIN out on the 18F1320 is different that the run of the mill Micro, on a 18 PIN DIP,soic pin 18 is PIN-B3, on a standard MICRO (18f84 etc) B3 is on PIN 9.
On the 18F1320, PIN 9 (B1) is your TX and PIN 10 (B4) is your RX for the Hardware RS232. I got court out on this one some time ago.
Andrew _________________ What has been learnt if you make the same mistake? |
|
|
info@ckmintech.com
Joined: 16 May 2006 Posts: 39
|
|
Posted: Wed May 17, 2006 6:52 am |
|
|
Thanks
Problem sloved with #fuses NOLVP |
|
|
|