Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

9-bit serial reception for PIC16f877

Status
Not open for further replies.

striker2509

New Member
hello again, how's everything around here?

Here my question, i already enable the 9-bit reception, i read the 8 lsb from the RCREG 8 bit register, but....where i can check the 9 bit?

If i can check it, suppossed that i send a d'260' from pc, the pic will receive b'00000100' and the ninth bit will be set. And then i send a d'12', the pic will receive b'00001100', the ninth bit will remain set, o will be turn to zero?

Thanks again
Striker
 
striker2509 said:
hello again, how's everything around here?

Here my question, i already enable the 9-bit reception, i read the 8 lsb from the RCREG 8 bit register, but....where i can check the 9 bit?

If i can check it, suppossed that i send a d'260' from pc, the pic will receive b'00000100' and the ninth bit will be set. And then i send a d'12', the pic will receive b'00001100', the ninth bit will remain set, o will be turn to zero?

Thanks again
Striker
lol, 9 bit tramsmission means that you will send/receive bit's from 0 to 8 (that's 9 bits...) and with bit's 0-7 in RCREG and bit no 8 in RCSTA,RX9D ...
 
Isn't the ninth bit the parity bit?, and if not, what are you using to send 9 bit serial data?.

Generally if you need more than 8 bits you would use two bytes to send it, although if you're sending PIC to PIC and using software UART's you can always use more bits if you want - but you should be aware that the longer the word, the more chance of errors!.
 
Generally if you need more than 8 bits you would use two bytes to send it, although if you're sending PIC to PIC and using software UART's you can always use more bits if you want - but you should be aware that the longer the word, the more chance of errors!.

Nice idea nigel, I trully need more than 8 bits, the thing is that i need to compare large numbers, like 500 or so, i know that i cant send 500 with 8 bit data transmission, but i can do it with 16 bit data. In that case, how can i compare it?. it going to be stock in RCREG in FIFO way, or something like that?. How can i compare it?. That's why i was thinking in the 9 bit, it goes 511 tops, but i found that 2 bytes idea more interesting.
 
striker2509 said:
Nice idea nigel, I trully need more than 8 bits, the thing is that i need to compare large numbers, like 500 or so, i know that i cant send 500 with 8 bit data transmission, but i can do it with 16 bit data. In that case, how can i compare it?. it going to be stock in RCREG in FIFO way, or something like that?. How can i compare it?. That's why i was thinking in the 9 bit, it goes 511 tops, but i found that 2 bytes idea more interesting.

I can hardly claim originality for the idea - it's simply how it's done, and how it's always been done!. Save the two bytes of data in two GPR's, and do a 16 bit compare with your 16 bit reference value (whatever that is). If you look on the PICList they have a complete section about comparisons, including 16 bit ones.
 
Even if is not your idea, i have to thank you anyway, im already checking out the PiClist page. The thing is that i though that transmitting serial mode... i can only find the received data in RCREG, now you tell me that i can save it on 2 general purpose register. This i have to do it by code, right?. How can i tell that the 2 bytes transmitted is in fact in the GPR that i wanted....once again thank you and sorry if im asking stupid questions.

thanks again
Striker
 
striker2509 said:
Even if is not your idea, i have to thank you anyway, im already checking out the PiClist page. The thing is that i though that transmitting serial mode... i can only find the received data in RCREG, now you tell me that i can save it on 2 general purpose register. This i have to do it by code, right?. How can i tell that the 2 bytes transmitted is in fact in the GPR that i wanted....once again thank you and sorry if im asking stupid questions.

Something like:

Code:
call GetSerial
movwf GPR1
call GetSerial
movwf GPR2

Simply read a byte from the serial port and store it in the first GPR, then read another byte and store it in the second. Obviously the subroutine call will depend on what YOU call it, and the example above relies on it returning the byte in W.
 
The data sheet states that the PICs can send and receive 9 bit data - though I have not tried it. If you look at the transmit and receive status registers, you will find the 9th bit and the text states that it can contain the 9th bit OR a parity bit.

Mike.
 
how do i interface pic16f877 with gps engine

Hi all i don know am placing this msg write or not as am new here any ways am tryin to attach a gps engine with pic16f877 i know rs232 will be used in between but how the proces go on ?
 
Re: how do i interface pic16f877 with gps engine

salmankhan said:
Hi all i don know am placing this msg write or not as am new here any ways am tryin to attach a gps engine with pic16f877 i know rs232 will be used in between but how the proces go on ?

As far as I know GPS units send out ASCII characters via a serial interface, they are simple to connect to a PIC. Check my tutorials for details of RS232 on a PIC.
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top