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

P1C18F1320 & RS232

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
info@ckmintech.com



Joined: 16 May 2006
Posts: 39

View user's profile Send private message

P1C18F1320 & RS232
PostPosted: Tue May 16, 2006 7:20 pm     Reply with quote

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)

View user's profile Send private message Send e-mail MSN Messenger

PostPosted: Wed May 17, 2006 12:16 am     Reply with quote

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

View user's profile Send private message

PostPosted: Wed May 17, 2006 12:47 am     Reply with quote

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

View user's profile Send private message Send e-mail

PostPosted: Wed May 17, 2006 12:49 am     Reply with quote

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? Wink
info@ckmintech.com



Joined: 16 May 2006
Posts: 39

View user's profile Send private message

PostPosted: Wed May 17, 2006 6:52 am     Reply with quote

Thanks

Problem sloved with #fuses NOLVP
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