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

INT_RB and USART

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







INT_RB and USART
PostPosted: Fri Jul 08, 2005 5:44 pm     Reply with quote

Hello,

It is needed to sampling RB7 by INT_RB interrupt.
all other pins PIN_B6,B5 are not used, and of course pulled up.

I have very surprised that RB4 input configured as RXD
generating INT_RB interrupt on serial data reception.

In other words if PIC USART working on high baudrates such 57600,
there is not possible to use INT_RB.
every changes in RXD will generate INT_RB routine.

this is about 18F1320 part.

Is there anybody to help me?

Julius
valemike
Guest







PostPosted: Fri Jul 08, 2005 8:51 pm     Reply with quote

My first guess is that you are using the software UART ccs libraries. If you were to make it use the hardware usart module in the PIC, you shouldn't be getting those interrupts.
julius
Guest







PostPosted: Fri Jul 08, 2005 11:48 pm     Reply with quote

Of course UART is enabled by hardware by register RCSTA TXSTA... directly using
NOT #use RS232 (),

By 18F1320 datasheet , PIN_B4 / RX / DT only port as analog input setting, will disable TTL input.

I have some projects with RB changes and USART using also, but with part 16LF876 without problems.

julius
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Sat Jul 09, 2005 12:49 am     Reply with quote

Quote:
I have very surprised that RB4 input configured as RXD
generating INT_RB interrupt on serial data reception.


How are you defining the UART ? The hardware UART pins are B1
and B4 (for Tx and Rx) in the 18F1320. Your #use rs232() statement
should look like this:
Code:
#use rs232(baud=57600, xmit=PIN_B1, rcv=PIN_B4, ERRORS)


If you're doing it some other way, then post your code.

Also post your version of the PCH compiler.
Julius
Guest







PostPosted: Sat Jul 09, 2005 1:10 am     Reply with quote

Im not using the CCS #use RS232(...)

here is init statements in main() {

set_tris_b(0b10011010); // B7 input for qaudr.encoder, B4 RXD
port_b_pullups(TRUE); //

// ---- ASYNC PORT INIT ---
SPBRG= 62; // 9600 baud on 38.400MHz = XTAL9.600MHz x 4PLL
BAUDCTL = 0;
TXSTA = 0x20; // BRGH=0
RCSTA = 0x90;

RBIP=1; // priority na PB change interrupt
enable_interrupts(INT_RDA);
RBIE=1; // PORTB change INT enable
enable_interrupts(GLOBAL);

while(1) { // never ending story

delay_ms(200); // restart_wdt
printf(myputc,"%u",count); // count is incremented in RB change handler
}
==================


so, in the #INT_RB handler it is possible to count++ variable
and in the main scope printing the count

on any serial character sending to PIC PIN_B4 INT_RB will occur depending the character, such SPACE = 0x20 makes cca 4 interrupts
start bit, databit, stop bit...

I will try the delay_ms() remove from code, its unknown procedure sometimes from CCS.

Julius
Julius
Guest







PostPosted: Sat Jul 09, 2005 1:10 am     Reply with quote

Im not using the CCS #use RS232(...)

here is init statements in main() {

set_tris_b(0b10011010); // B7 input for qaudr.encoder, B4 RXD
port_b_pullups(TRUE); //

// ---- ASYNC PORT INIT ---
SPBRG= 62; // 9600 baud on 38.400MHz = XTAL9.600MHz x 4PLL
BAUDCTL = 0;
TXSTA = 0x20; // BRGH=0
RCSTA = 0x90;

RBIP=1; // priority na PB change interrupt
enable_interrupts(INT_RDA);
RBIE=1; // PORTB change INT enable
enable_interrupts(GLOBAL);

while(1) { // never ending story

delay_ms(200); // restart_wdt
printf(myputc,"%u",count); // count is incremented in RB change handler
}
==================


so, in the #INT_RB handler it is possible to count++ variable
and in the main scope printing the count

on any serial character sending to PIC PIN_B4 INT_RB will occur depending the character, such SPACE = 0x20 makes cca 4 interrupts
start bit, databit, stop bit...

I will try the delay_ms() remove from code, its unknown procedure sometimes from CCS.

Julius
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