|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Get inside! Sample the range of functionality easily built with JMSL Library for Time Series Data Analysis, Heat Maps, Portfolio Optimization, Monte Carlo Simulation, Stock Price Charting and more. Download Now! |
|
#1
|
|||
|
|||
|
array question in Assembly 68HC11
Hello ppl!
I have question about arrays in assembly 68HC11. I need to create an 8 byte array which holds my motor ids. So I recieve this byte 'id' from serial port which is from (0-7). I want to use that id as an index, to get the value in 'motor' array. Basicly I am trying to do this: MOTORID=MOTORARRY[MID] I dont have too much experience in Motorola processor. ![]() Here is what I did, and parts from the code & it compiles fine but does not work ----------- Code:
-reserving space for it MOTORARRY RMB 8 ; stepper motor select array -storing array values. LDAA #%00000000 STAA SPMTRARY LDAA #%00000001 STAA SPMTRARY+1 LDAA #%00000100 STAA SPMTRARY+2 LDAA #%00000101 STAA SPMTRARY+3 LDAA #%01000000 STAA SPMTRARY+4 LDAA #%01000001 STAA SPMTRARY+5 LDAA #%01000100 STAA SPMTRARY+6 LDAA #%01000101 STAA SPMTRARY+7 -accessing part JSR GETCHE ; this subroutine saves the value on Acc A. STAA MID ; stores A on to ID LDD MID ADDD #MOTORARRY XGDX LDD 0,X STD MOTORID Anybody can point out where I did the mistake or any other/better suggestions creating this array and accessing it. I would appreciate any help. Thanks. |
|
#2
|
||||
|
||||
|
Um... sorry if I can'thelp much... but here's what I think. I'm no assembly whiz but I used to do a bit of mips and when you wanted to read a byte or store a byte you needed a hiword offset and then another number from there.
So what you can do is use the MOTOARRY but not use the [] becuase I don't even know if those can be used to make arrays or something (I told you I sucked..) You put that as the base and hiword address and then you just add a numer to it. Code:
lbu $10, 0x0000($8)
lbu $11, 0x0001($8)
lbu $12, 0x0002($8)
lbu $13, 0x0003($8)
lbu $14, 0x0004($8)
In here the $* things are registers and this loads a byte from $8 (base address)+0x0001 (the number of bytes away from the address) and stores it into register $11. So if you can get this sort of thing going that might be good enough. By the way... what you builing???!? It sounds pretty cool and I wanted to get into electronics or robotics anyway... ![]() |
|
#3
|
|||
|
|||
|
I need help with simple assembly bubble sort program, needs to sort 10 numbers
I need help with assembly program to bubble sort 10 numbers
jmartin732 I have question about arrays in assembly 68HC11. I need to create an 8 byte array which holds my motor ids. So I recieve this byte 'id' from serial port which is from (0-7). I want to use that id as an index, to get the value in 'motor' array. Basicly I am trying to do this: MOTORID=MOTORARRY[MID] I dont have too much experience in Motorola processor. ![]() Here is what I did, and parts from the code & it compiles fine but does not work ----------- Code:
-reserving space for it MOTORARRY RMB 8 ; stepper motor select array -storing array values. LDAA #%00000000 STAA SPMTRARY LDAA #%00000001 STAA SPMTRARY+1 LDAA #%00000100 STAA SPMTRARY+2 LDAA #%00000101 STAA SPMTRARY+3 LDAA #%01000000 STAA SPMTRARY+4 LDAA #%01000001 STAA SPMTRARY+5 LDAA #%01000100 STAA SPMTRARY+6 LDAA #%01000101 STAA SPMTRARY+7 -accessing part JSR GETCHE ; this subroutine saves the value on Acc A. STAA MID ; stores A on to ID LDD MID ADDD #MOTORARRY XGDX LDD 0,X STD MOTORID Anybody can point out where I did the mistake or any other/better suggestions creating this array and accessing it. I would appreciate any help. Thanks.[/QUOTE] |
|
#4
|
|||
|
|||
|
copy array
Hello there!
i am a beginner of shadow11 programming.. Want to write a program to coppy 300 double-byte unsigned number from array1 to array2. The end of data in array1 marked as $FFFF. The data from array1 is coppy to array2 until marker found but if the marker not found all data go to array2. Could anybody help me...? Thank you ![]() |
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > Other Programming Languages > array question in Assembly 68HC11 |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|