Author Topic: Program example to read RCREG  (Read 4584 times)

0 Members and 1 Guest are viewing this topic.

Offline Dave_PT

  • Frequent Contributor
  • **
  • Posts: 282
  • Country: pt
    • DavidMartinsEngineering
Program example to read RCREG
« on: December 07, 2012, 11:06:30 pm »
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.
 

Offline David_AVD

  • Super Contributor
  • ***
  • Posts: 2607
  • Country: au
Re: Program example to read RCREG
« Reply #1 on: December 08, 2012, 08:00:26 am »
Wouldn't you just assign RCREG to another variable?

Something like " SomeVariable = RCREG " ?
 

Offline Dave_PT

  • Frequent Contributor
  • **
  • Posts: 282
  • Country: pt
    • DavidMartinsEngineering
Re: Program example to read RCREG
« Reply #2 on: December 08, 2012, 09:36:23 am »
Hello

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.
 

Offline Dave_PT

  • Frequent Contributor
  • **
  • Posts: 282
  • Country: pt
    • DavidMartinsEngineering
Re: Program example to read RCREG
« Reply #3 on: December 09, 2012, 11:35:01 pm »
Can anyone help me please?

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

http://www.microchip.com/forums/m692901.aspx
 

Offline AlfBaz

  • Super Contributor
  • ***
  • Posts: 2038
  • Country: au
Re: Program example to read RCREG
« Reply #4 on: December 10, 2012, 06:12:22 am »
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.






 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf