Other Programming Languages
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Try It Free
Go Back   Dev Shed ForumsProgramming Languages - MoreOther Programming Languages

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
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  
Old August 27th, 2004, 09:13 AM
esenlik esenlik is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2004
Location: NY
Posts: 24 esenlik User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 26 m 31 sec
Reputation Power: 0
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.

Reply With Quote
  #2  
Old August 27th, 2004, 10:49 AM
gt3_dk's Avatar
gt3_dk gt3_dk is offline
!Ruff Ryder!
Dev Shed Novice (500 - 999 posts)
 
Join Date: Jun 2004
Location: Québec, Canada... Represent!
Posts: 689 gt3_dk User rank is Corporal (100 - 500 Reputation Level)gt3_dk User rank is Corporal (100 - 500 Reputation Level)gt3_dk User rank is Corporal (100 - 500 Reputation Level)gt3_dk User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 3 Days 7 h 10 m 12 sec
Reputation Power: 7
Send a message via Yahoo to gt3_dk
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...

Reply With Quote
  #3  
Old November 2nd, 2006, 10:19 PM
Jmartin732 Jmartin732 is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Nov 2006
Posts: 2 Jmartin732 Negative: is most likely a SPAMMER and a traitor to the cause. 
Time spent in forums: 1 h 2 m 33 sec
Reputation Power: 0
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]
Comments on this post
Dave Sinkula disagrees: Let sleeping threads lie. Read the date of the last post before replying.

Reply With Quote
  #4  
Old February 12th, 2007, 12:44 AM
kalimantang kalimantang is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2007
Posts: 1 kalimantang User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 11 m 56 sec
Reputation Power: 0
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
Comments on this post
salem disagrees: Yet another "me too" grave digger - not even on-topic

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreOther Programming Languages > array question in Assembly 68HC11


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 1 hosted by Hostway