PDA

View Full Version : After bootloading a 16f877a how can i get back rx tx ?



camolas
- 8th May 2008, 01:26
Hi,

After bootloading a 16f877a how can i get back rx(c.7) tx(c.6) to use the serin and serout in my code?
The bootload is the Screamer-v14 .They say "...Bloader will turn off the UART (CREN = 0 and TXEN = 0) upon exiting the boot loader program. If you program uses the UART, you will need to re-initialize the UART with your own settings.... "

How can i do this?

Thanks for all the hellp

byby


my code:

skimask
- 8th May 2008, 01:47
After bootloading a 16f877a how can i get back rx(c.7) tx(c.6) to use the serin and serout in my code?
The bootload is the Screamer-v14 .They say "...Bloader will turn off the UART (CREN = 0 and TXEN = 0) upon exiting the boot loader program. If you program uses the UART, you will need to re-initialize the UART with your own settings.... "
How can i do this?
Thanks for all the hellp


If the bootloader gives you control of the PIC, then you have control of the pins...case closed. Turn off the serial module and set up the pins as you see fit...case closed...
Unless of course, the bootloader circuitry is holding the pins at a certain logic level and won't release them.

camolas
- 8th May 2008, 13:09
Hi,

Thanks for the reply, did you see my code? i do not now how can i do that can you or other person onder my code explain how i can do it?

Thanks to all

by by

skimask
- 8th May 2008, 14:56
Hi,
Thanks for the reply, did you see my code? i do not now how can i do that can you or other person onder my code explain how i can do it?
Thanks to all
by by

You mean the code attached to post #1? Nope, didn't see it...

Of course I saw it!
Re-Read post #2.
I don't know what your problem is. Seems to me like anybody else would be able to manipulate those pins as they see fit...if the hardware allows it...

mister_e
- 8th May 2008, 18:28
Once you enable the USART, like the Bootloader do, you can't use RX/TX pin with serout. Use HSEROUT instead... OR get rid of all DEFINES, and disable SPEN bit....

Your program shouldn't finish like that... use STOP of do a loop.

camolas
- 8th May 2008, 19:01
Hi ive used HSEROUT in my code but dont work, im new at this for other person my be very simple but not for :(

Please can you explain me in a beginer mode?

Is how i used the HSEROUT


Code:

DEFINE LOADER_USED 1
@ device hs_osc
define osc 20
Include "modedefs.bas" ' Include serial modes

DEFINE HSER_BAUD 9600 'Hser baud rate
DEFINE HSER_SPBRG 129 'Hser spbrg init
DEFINE HSER_RCSTA 90h 'Hser receive status init
DEFINE HSER_TXSTA 24h 'Hser transmit status init
DEFINE HSER_CLROERR 1

TrisB.5=0
TrisC.6=0
TrisC.7=1
B0 var byte

High portb.5
Pause 500
Low portb.5
Pause 500
High portb.5
Pause 500
Low portb.5
Pause 500




serout2 portc.6, 32, ["AT", 13]
serout2 portc.6, 84, ["AT+CMGF=1", 13]
serout2 portc.6, 84, ["AT+CSCA=+351xxxxx000", 13]
serout2 portc.6, 84, ["AT+CSCA=+3xxxxxxxxx0", 13]
serout2 portc.6, 84, ["ola", 13]
end



Thanks,


By By

mister_e
- 8th May 2008, 19:52
DEFINE LOADER_USED 1
define OSC 20 ' Check the spelling of OSC, must be in capital letter

Include "modedefs.bas" ' Include serial modes

DEFINE HSER_RCSTA 90h ' Enable serial port & continuous receive
DEFINE HSER_TXSTA 24h ' Enable transmit, BRGH = 1
DEFINE HSER_SPBRG 129 ' 9600 Baud @ 20MHz, 0.16%
DEFINE HSER_CLROERR 1 ' Clear overflow automatically

TrisB.5=0
TrisC.6=0
TrisC.7=1
B0 var byte

High portb.5
Pause 500
Low portb.5
Pause 500
High portb.5
Pause 500
Low portb.5
Pause 500

HSEROUT ["AT", 13]
HSEROUT ["AT+CMGF=1", 13]
HSEROUT ["AT+CSCA=+351xxxxx000", 13]
HSEROUT ["AT+CSCA=+3xxxxxxxxx0", 13]
HSEROUT ["ola", 13]
STOP
end

camolas
- 8th May 2008, 20:18
Steve it works very well, thanks a lot for the patience to teach a beginer like me.I will learn this one more lesson.
Sory abouht the box of the code next time i will put it there.

p.s. If you need same thing from Portugal let me now.

By BY