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.

Manchester Encoding

Status
Not open for further replies.

MessUpMymind

New Member
hi there,

just a question here , concern regarding RF remote control , my question is if i using nigel tutorial which is sending 1 packet at once , is that possible i can make a loop to transmit as many packet as i wan (reuse the 1 packet over and over again)?? using the same code. more in details is i am actually doing a project which is sending a string of data for example "ELECTRO" those alphabet in ascii , but in my project user is the 1 determine what words to put in , therefore i cant determine the packet size in the PIC.

By sending one byte of ascii once until the end of character is what my idea about..is that possible??

Note: Nigel Tutorial 12.3 that i refer to as sending 1 packet.

Help is much appreciated here.

Thanks!!:)
 
I'm a little confused as to what you're asking - if you want to use a single packet system, them you simply call the send routine in a loop with each character loaded as the packet as you loop round.

But single packets are very inefficient, because of the overhead with each packet - so you're probably better off using a longer packet size. Perhaps use a four byte packet, and pad the remainder of the last packet with null bytes of some kind.
 
hi nigel ,

that means it's possible to send a single packet everytime i wan to send a byte through RF transceiver , sir what you mean by overhead with each packet?? i will try 4 bytes packet later on. as single packet is more easier to understand than four byte packet i see in your tutorial .

THanks for your fast reply =).
 
hi nigel ,

that means it's possible to send a single packet everytime i wan to send a byte through RF transceiver.

Yes, that is possible. If the user is entering the message, then it will be best if you design the system such that the end of the message is terminated with the null character. Then you can make your program loop around, transmitting a byte at a time, until the null character is found.

As Nigel has said this would be a little bit inefficient because each packet will have some "overhead" associated with it, in terms of starts bits / stop bits / parity etc. I'm not sure that all of these things will be relevant, it depends upon the protocol you're using.

Is this inefficiency a problem? Well, it depends on your application. If you're only going to transmit short messages and speed of operation is not a primary concern, then no it won't be a problem. But if you're going to transmit a lot of information then the extra overhead per character will soon become significant.

If the overhead is a concern then of course you can send more bytes per packet if you want. If you used a 4 byte system then you would only have overhead associated with every 4 characters, instead of each character. The disadvantage to this is if the packet becomes corrupt you're likely to lose more information.

The choice really depends on your application.

Brian
 
The tutorial expalins it, here's a clip:

This gives a total of 52 bits to send just a single 8 bit data byte, but by transmitting more than one byte in a packet this can be improved, two bytes will take only 62 bits, or four bytes only 82 bits.
 
I couldn't check your tutorial from work as it happens Nigel. I did try to have a look just so that I could gain a better understanding of the type of communication being talked about, but our work firewall complains at me when I try to access your page.

I'll try it at home later. Probably just our work firewall being too touchy.
 
hi there ,

after i modified it , i got problem in sending ...although there's signal come out but it seem to only transmitting continous 1 , why is that happen that way??here's my code , what i do is when i receive data from PC in ascii form i will store it in some register first using indirect addressing , when i accept end of transmission from pc i will start to send packet out 1 byte once and it loop till the data has been finished transmitted all.


Code:
SerInit:
		banksel SPBRG
        movlw  .25		   ;baud rate for 9600 Fosc = 4Mhz
        movwf  SPBRG       ; baud rate
		banksel	TXSTA
        bsf    TXSTA, BRGH ; high speed
        bcf    TXSTA, SYNC ; async mode
        banksel RCSTA
        bsf    RCSTA, SPEN ; enable serial port
        bsf    RCSTA, CREN ; enable continous receive 
		GOTO 	chk


SerRX1: 
		banksel PIR1
		btfss PIR1,RCIF    ; Wait until character is received complete 1 byte
        goto  SerRX1		;	 
		movf  RCREG,W		;store it
		movwf store1

	    return 

chk:	call	SerRX1
		movlw	0x03
		xorwf	store1
		btfss	STATUS,Z
		goto	buffer
		goto	bufferend

buffer: movf	store1,w
		movwf	INDF
		INCF	FSR,f
		goto	chk

bufferend:movlw	0x03	;0x03 ETX 
		  movwf	INDF
		  goto  transmit
		  		
; [][][][][][][][][][][][][][][][][][][][][][][][][][]
;======================Send Packet====================
; data retrieve		
transmit:           	movlw	current_table
			movwf	FSR
transmit1:	         movf	INDF,w
			movwf	store
			call	mt_s
			movf	INDF,w
			xorwf	S1
			btfsc	STATUS,Z
			goto	stop
			incf	FSR,f 
			goto	transmit1
									
mt_s:	;put packet length here to try out maybe is because of packet length that restricted the transmission of data
		call 	mtx_init
		movlw	0xAA			;set address byte to 0xAA
		movwf	mtx_buffer


		movf	store,w
		movwf 	mtx_buffer1 ;put in data storage
		call	mtx_send    ;call data send routine (encoding)
		call	Delay50
		return
Thanks for helping me =)
 
hi there,

i just discover that , when i send one byte of data with manchester coding it will keep repeat sending the same byte of data over and over again. why is this happening??

thanks =)
 
hi nigel,

i was wondering too , as i did check my routine that as follows:
Code:
Loop
		movlw	0xAA			;set packet address byte to 0xAA
		movwf 	mtx_buffer
		movlw	'N'
		movwf 	mtx_buffer1
		call	mtx_send
		call	Delay20
		goto	stop
               .
               .
               .
stop:
                 END

from that code isn't that suppose to end when transmitting 1 'N' out?? but from oscilloscope i see the waveform is repeating over and over again.
 
hi nigel,

i was wondering too , as i did check my routine that as follows:
Code:
Loop
		movlw	0xAA			;set packet address byte to 0xAA
		movwf 	mtx_buffer
		movlw	'N'
		movwf 	mtx_buffer1
		call	mtx_send
		call	Delay20
		goto	stop
               .
               .
               .
stop:
                 END

from that code isn't that suppose to end when transmitting 1 'N' out?? but from oscilloscope i see the waveform is repeating over and over again.

Your STOP doesn't do anything, of course it's going to repeat over and over - the code will run completely through the PIC's memory, and loop back to the start to run again, and again, and again...............
 
hi nigel ,

sorry i was having a trouble on my laptop past few days , ok i understand what you mean by now . in that case how suppose i can end a process, the purpose of that stop label is meant to stop the whole process actually , i thought it will work that way...
thanks for your help nigel =)..
 
hi nigel ,

thanks so much so much for your help along this way , you are just great..i will try to improve and help others that need to as you did...you are great mentor =).

Regards
TK
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top