• AVR Freaks

Hot!CONFIGURATION BAUDRATE TO BE 9600 (PIC16F18875)

Page: < 12 Showing page 2 of 2
Author
Adwin Simanjuntak
Starting Member
  • Total Posts : 31
  • Reward points : 0
  • Joined: 2018/09/07 00:34:26
  • Location: 0
  • Status: offline
Re: CONFIGURATION BAUDRATE TO BE 9600 (PIC16F18875) 2018/10/17 00:00:45 (permalink)
+1 (1)
Why I can't upload the pict in this forum??? hmm
#21
qhb
Superb Member
  • Total Posts : 9998
  • Reward points : 0
  • Joined: 2016/06/05 14:55:32
  • Location: One step ahead...
  • Status: offline
Re: CONFIGURATION BAUDRATE TO BE 9600 (PIC16F18875) 2018/10/17 00:02:08 (permalink)
0
I would actually recommend you get the serial receive working WITHOUT interrupts first.
Just looking at what you have done, you have not shown any code which sets the RCIE bit, so you won't be getting interrupts when you receive anyway.
Are you switching the RX pin from analog to digital mode anywhere in your code?
In your ISR, you try to clear the RCIF flag. That flag is read-only, you CANNOT clear it like that. The only way to clear it is by reading RCREG.
 

Nearly there...
#22
Adwin Simanjuntak
Starting Member
  • Total Posts : 31
  • Reward points : 0
  • Joined: 2018/09/07 00:34:26
  • Location: 0
  • Status: offline
Re: CONFIGURATION BAUDRATE TO BE 9600 (PIC16F18875) 2018/10/17 00:20:17 (permalink)
0
qhb
I would actually recommend you get the serial receive working WITHOUT interrupts first.
Just looking at what you have done, you have not shown any code which sets the RCIE bit, so you won't be getting interrupts when you receive anyway.
Are you switching the RX pin from analog to digital mode anywhere in your code?
In your ISR, you try to clear the RCIF flag. That flag is read-only, you CANNOT clear it like that. The only way to clear it is by reading RCREG.
 


 I already wrote what you ask in my code in two function (below) and those are also I call in main program.


 
void enable_interrupt()
{

GIE=1; //Enable Global Interrupt
PEIE=1; //Enable the Peripheral Interrupt
TMR1IE=1; //Enable timer interrupt bit in PIE1 register
TMR2IE=1;
// PIE3 = (1 << _PIE3_RCIE_POSN);
RCIE = 1;
// TXIE=1;

}

 
 
void config_pin()
{
DISABLE_ANSEL_PORTB;
DISABLE_ANSEL_PORTC;
DISABLE_ANSEL_PORTA4;
ANSE1 = 0;
TRISE1 = 0;

TRISB = ((1 << _TRISB_TRISB7_POSN) | (1 << _TRISB_TRISB6_POSN)|
(1 << _TRISB_TRISB4_POSN) | (1 << _TRISB_TRISB3_POSN) |
(1 << _TRISB_TRISB2_POSN) | (1 << _TRISB_TRISB1_POSN) |
(1 << _TRISB_TRISB0_POSN));

TRISC = ((1 << _TRISC_TRISC7_POSN) | (1 << _TRISC_TRISC5_POSN) |
(1 << _TRISC_TRISC2_POSN)|(1 << _TRISC_TRISC1_POSN) |
(1 << _TRISC_TRISC0_POSN));

TRISA4 = 0; // PIN OUTPUT SHUTDOWN
TRISD3 = 0; // PIN OUTPUT BACKLIGHT
INACTIVE_BACKLIGHT;

remap_usart_pin();
PORTB = 0x00;
PORTC = 0x40;

// PORTE = 0x00;

}

#23
Adwin Simanjuntak
Starting Member
  • Total Posts : 31
  • Reward points : 0
  • Joined: 2018/09/07 00:34:26
  • Location: 0
  • Status: offline
Re: CONFIGURATION BAUDRATE TO BE 9600 (PIC16F18875) 2018/10/17 01:47:06 (permalink)
0
[RECENT UPDATE]
 
My PIC16F18875's RX always get "FF" char what ever my UNO sent
post edited by Adwin Simanjuntak - 2018/10/17 01:57:52

Attached Image(s)

#24
Equinoxin
New Users
  • Total Posts : 47
  • Reward points : 0
  • Status: offline
Re: CONFIGURATION BAUDRATE TO BE 9600 (PIC16F18875) 2018/10/22 10:56:54 (permalink)
0
Have you checked the PPS settings for the RX1 pin correctly on the PIC16F18875?
 
#25
Page: < 12 Showing page 2 of 2
Jump to:
© 2019 APG vNext Commercial Version 4.5