View previous topic :: View next topic |
Author |
Message |
kmp84
Joined: 02 Feb 2010 Posts: 345
|
help with asm code |
Posted: Mon Sep 14, 2015 7:28 am |
|
|
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: 9221 Location: Greensville,Ontario
|
|
Posted: Mon Sep 14, 2015 8:04 am |
|
|
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
|
|
Posted: Mon Sep 14, 2015 8:23 am |
|
|
Thanks Mr."temtronic"! It is a good idea. |
|
|
kmp84
Joined: 02 Feb 2010 Posts: 345
|
|
Posted: Wed Sep 16, 2015 2:44 am |
|
|
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
|
|
Posted: Wed Sep 16, 2015 2:57 am |
|
|
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: 9221 Location: Greensville,Ontario
|
|
Posted: Wed Sep 16, 2015 4:54 am |
|
|
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 |
|
|
|