CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

help with asm code

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
kmp84



Joined: 02 Feb 2010
Posts: 345

View user's profile Send private message

help with asm code
PostPosted: Mon Sep 14, 2015 7:28 am     Reply with quote

Hello developers,

Can anybody help me with this asm code?

Code:

//transmit
SendHostByte:
    clrwdt
    btfss   UxPIR, UxTXIF      ; Write only if TXREG is ready
    bra     $-2
   
    movwf   UxTXREG           ; Start sending
//receiv
ReadHostByte:
    btfsc   UxRCSTA, OERR       ; Reset on overun
    reset

WaitForHostByte:
    clrwdt
    btfss   UxPIR, UxRCIF       ; Wait for data from RS232
    bra     WaitForHostByte

    movf    UxRCREG, W          ; Save the data
    movwf   RXDATA
 
    return



I want to modify above code to support rs485 halfduplex direction control pin.

Thanks
temtronic



Joined: 01 Jul 2010
Posts: 9161
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Mon Sep 14, 2015 8:04 am     Reply with quote

Why bother ? CCS does have complete, working C code for RS485 ! It's one of their great examples in the 'examples' folder...
However if you really, want to modify that assembler, try the Microchip Assembler forum or if you need to cheat, simply compile the CCS rs485 example and dump the listing.It's all there.

Jay
kmp84



Joined: 02 Feb 2010
Posts: 345

View user's profile Send private message

PostPosted: Mon Sep 14, 2015 8:23 am     Reply with quote

Thanks Mr."temtronic"! It is a good idea.
kmp84



Joined: 02 Feb 2010
Posts: 345

View user's profile Send private message

PostPosted: Wed Sep 16, 2015 2:44 am     Reply with quote

Hello All,
I have no success with this asm code. I'm trying to modify Microchip's AN1310 bootloader code to work over half duplex rs485 network with direction control on PIN_D2.
RF_Developer



Joined: 07 Feb 2011
Posts: 839

View user's profile Send private message

PostPosted: Wed Sep 16, 2015 2:57 am     Reply with quote

kmp84 wrote:
I'm trying to modify Microchip's AN1310 bootloader code to work over half duplex rs485 network with direction control on PIN_D2.


This is is much better question - its about what you are trying to do, not just what isn't working.

I've got that working. Not a big problem. I don't think I used D2, but that's easily changed. I'm not sure I can share it, however. I'll see what I can do.

Hint: I didn't do it byte by byte. I left the link in receive except when sending something.
temtronic



Joined: 01 Jul 2010
Posts: 9161
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Wed Sep 16, 2015 4:54 am     Reply with quote

Now that we know what you're up to.... why not just use the CCS bootloader ? I'm sure someone here has already got it running on RS485. Maybe search this forum or the code library for working solutions.

Jay
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group