Electronics > Microcontrollers

Program example to read RCREG


Hello all.

I am doing some tests with the compiler XC8.
I wore before CCS, but it did not satisfy me ...

I just started to learn to work with the compiler XC8, but right now I can not get a code to read the USART.

The code is all set, but I do not see how I will get to RCREG values??.

Some example please?

I also can not use "scanf" and can not find much information on the microchip that ...

Thank you.

Wouldn't you just assign RCREG to another variable?

Something like " SomeVariable = RCREG " ?


At the same time I'm simulating in proteus and when I do I can not get anything.

What I do is enable the reception of data and wait for a change in RCIF flag.
If you do, the flag RCIF never changes ...

Have experienced using scanf such as scanf ("% d", & v) ... but get an error saying I do not have 256 bytes available ...

Thank you.

Can anyone help me please?

I bet it is a very stupid mistake on my part ... but I can not find!


DarioG has posted twice with your probable answer. If you don't clear the usart error flags in the appropriate register nothing more happens.

Also you need to make sure rcreg has been read prior to going into your loop. All this info is in the data sheet

The other thing going on is you are simulating this in proteus, who knows whats going on there.

In that microchip post, you have some of the best and most helpful people on that forum helping you. If you don't give them feedback on their suggestions, simply restating your original problem isn't going to get you any further help.


[0] Message Index

There was an error while thanking
Go to full version
Powered by SMFPacks Advanced Attachments Uploader Mod