Where to Place Assembly Code

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

Where to Place Assembly Code

838件の閲覧回数
Designer11
Contributor IV

Hello Everyone,

 

First of all i haven't program in assembly for a long long time, since my college years. Anyway, I added a few lines of assembly code to the original serial bootloader, and i placed it between main and IFDEFIRQOPTION. The reason i added the codes between main and IFDEFIRQOPTION is to toggle those pins before the actual serial communication takes place. After power cycle, i measure pin 3 status to see if it's indeed set to high but nothing changes.

 

Could someone shows me what am i doing wrong ?

 

main:   ;********************************************************************************   ;Configure the chip into RS-232 Mode. Before receiving data from the bootloader   ; Data Direction settings on pin ports  =>OUTPUT   ;********************************************************************************        BSET      7,PTADD_PTADD7                ; Set RS232/RS485 data direction pin to output       BSET      2,PTBDD_PTBDD2                ; Set Receiver Enable data direction pin output       BSET      3,PTBDD_PTBDD3                ; Set Driver Enable direction pin to output   ;********************************************************************************   ;Configure the LTC2870 in RS-232 Mode.   ;Enable/Disable the following pins   ;********************************************************************************        BSET      3,PTBD_PTBD3           ;DXEN:  RS232/485 Driver Enable  =1       BCLR      2,PTBD_PTBD2           ;!RXEN: Receiver Enable active low =0       BCLR      7,PTAD_PTAD7           ;RS232 Mode  =0            IFDEF IRQOPTION       BIH      PVEC0                   ; if IRQ high, jump directly to real app.     ENDIF       LDA      SRS        

 

Thanks

D

ラベル(1)
0 件の賞賛
返信
4 返答(返信)

639件の閲覧回数
Designer11
Contributor IV

I made a mistake in my assignment;

BSET      3,PTBD_PTBD3           ;DXEN:  RS232/485 Driver Enable  =1


doesn't equal

BSET      3,02           ;DXEN:  RS232/485 Driver Enable  =1

0 件の賞賛
返信

639件の閲覧回数
tonyp
Senior Contributor II

Ah, but of course.  You used the pin name for port name.  I use my own definition files and naming conventions (rather than Freescale's) so this wasn't obvious at first.  It should probably be:

BSET      PTBD_PTBD3,PTBD     ;DXEN:  RS232/485 Driver Enable  =1

(similar for the other pins)


Glad you found it!

0 件の賞賛
返信

639件の閲覧回数
tonyp
Senior Contributor II

(It would help a bit to mention the MCU variant you're using.)

I'm assuming it's not the case of the input-only pin, or a hardware problem (e.g., grounded pin).

So, pin B3 is low instead of high?  When do you check pin B3 status?  Have you stopped the program (with a BDM debugger) right after the BSET instruction to test the pin?  If not, could some other instruction later on change the pin back to low?

639件の閲覧回数
Designer11
Contributor IV

Hi Tony,

Thanks for your reply and insights. The mcu I'm currently using is MC9S08QE32. I'm adding the assembly codes  in conjunction with the Developer's Serial Bootloader mentioned in AN2295 developed by Pavel. I programed the part and check the status after it programmed. I haven't step thru the code to check the pin high/low status in DBM yet. i will do that and report back.

0 件の賞賛
返信