[SOLVED] How to implement a string command syntax with PIC assembly

Status
Not open for further replies.

kemalkemal

Member level 1
Joined
Jan 27, 2013
Messages
38
Helped
1
Reputation
2
Reaction score
1
Trophy points
1,288
Activity points
1,672
Hi,
Fırst of all I am using PIC18f4520 , MPLABX and assembler. I want to use a serial port data plotter which I downloaded from Microchips site named "PIC Data Plotter". **broken link removed**
According to PIC Data Plotters user guide to configure the program and then to send data which is to be plotted you need to use a command syntax like this:
#NOP\r\n
Or another command from the guide is this:
#GS;3\r\n
The exact words about command syntax from help file is:
After i implement the command i will send it through USART module to serial comm port. I try this structure but didnt work
Code:
MOVLW 0x23 ;# 
MOVWF data_h
CALL P18_usart_send

MOVLW 0x4E ;N 
MOVWF data_h
CALL P18_usart_send

MOVLW 0x4F ;O 
MOVWF data_h
CALL P18_usart_send

MOVLW 0x50 ;P 
MOVWF data_h
CALL P18_usart_send

MOVLW 0x5C ;\
MOVWF data_h
CALL P18_usart_send 
 
MOVLW 0x72 ;r
MOVWF data_h
CALL P18_usart_send 
 
MOVLW 0x5C ;\
MOVWF data_h
CALL P18_usart_send
 
MOVLW 0x6E ;n
MOVWF data_h
CALL P18_usart_send

(P18_usart_send routine is my send routine and i do know it is working properly)
So my question: is my code structure to implement command #NOP\r\n right ? Or should i try something different?
Thanx in advance.
 

Hi,

I assume "\r" means "carriage return" which is a single byte with the value "0x0D"
And "\n" means "new line" which is a single byte with the value "0x0A"

Klaus
 
It worked. You are a life saver KlausST Thanx.
( One note if someone interested; After i change "\r" and "\n" with the right codes , I reversed the order of sent bytes because program accepts little endian data. Final and correct core :

Code:
MOVLW	0x0A		    ;\n
MOVWF	data_h
CALL	P18_usart_send    
   
MOVLW	0x0D		    ;\r
MOVWF	data_h
CALL	P18_usart_send      
   
MOVLW	0x50		    ;P		    
MOVWF	data_h
CALL	P18_usart_send    
   
MOVLW	0x4F		    ;O		    
MOVWF	data_h
CALL	P18_usart_send   
   
MOVLW	0x4E		    ;N		    
MOVWF	data_h
CALL	P18_usart_send    
   
MOVLW	0x23		    ;#		    
MOVWF	data_h
CALL	P18_usart_send
 

Hi,

I reversed the order of sent bytes because program accepts little endian data.
I doubt this. I´ve never seen a string that is sent in the wrong order.

Afaik. Little_endian and big_endian is mainly for storing mulibyte integer values in memory. (not 100% sure)

Klaus
 

Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…