Array
will this work?
Que var byte (16)
temp var byte (16)
Que()=temp()
or do I have to do:
for x=0 to 15
Que(x)=temp(x)
next
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Que var byte (16)
temp var byte (16)
Que()=temp()
or do I have to do:
for x=0 to 15
Que(x)=temp(x)
next
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Comments
...moves the contents of array1 into array2
it did not work!
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
I used the SXsim
Dear Jonny,
I tried this program:
i=0
do
· x(i)=1
· inc i
loop until i=16
·put x, y(0) to y(15)
end
the result was:
only two bytes has changed to 0
X(0)· -->0
x(1) -->0
x(2) -->1
.
..
x(15) --->1
what did I do wrong?
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
I'm unsing latest version of SX/B (2.00.24)
I tried your code and it worked fine. BUT mine( below) did not work!!
in my code, since I'm using many subs, I had to move my SUB definitions·inside the interrupt area (based on Bean's recommendations) because the compiler complained when I had them before the interrupt code.
I checked the ASM code of my program and I found that the compiler translated the PUT command differently !!
What do you think?
ID············· "Master"
DEVICE········· SX28, OSCXT2, BOR22
FREQ··········· 20_000_000
'
' I/O Pins
'
'
' Constants
'
Int_Req···CON·5
Ext_Req···CON·4
No_Req···CON·2
'
' Variables
'
QUE··VAR·byte (16)
Temp··VAR·Byte (16)
password·var·word
tmp··VAR·Byte··' work vars
Cam_time·Var·byte··' Wating time after Cam-on
Stop_time·Var·byte··'wating time before closing the Cam/door
Light_timer·var·tmp
Last_flr·var·byte
'camfail_cnt·VAR·byte
Slow_timeout·var·byte
fast_timeout·var·byte
Que_cntr·VAR·Byte
Crnt_flr·VAR·byte
collective_opt·var·bit··'0= full collective, 1=Down collective
Door_option·Var·bit··'0=normal·1=Automatic
dir··VAR·bit··'0=down··1=up
light_flag·VAr·bit··'0=light is off·1=lights is on
'
·INTERRUPT
'
goto ISR_Start
' =========================================================================
' Subroutine / Function / Task Declarations
' =========================================================================
TX_byte··SUB·1,1,Byte
RX_byte··FUNC·1,1
LCD_INIT·SUB·0···' initialize LCD
LCD_BLIP·SUB·0···' blip LCD "E" pin
LCD_CMD··SUB·1, 1, Byte··' send LCD command
LCD_OUT··SUB·1, 1, Byte··' print char on LCD
LCD_STR··SUB·2, 2, Word··' print string on LCD
LCD_SET_CRSR·SUB·1, 1, Byte··' set cursor mode
DELAY_MS·SUB·2, 2, Word, Word·' shell for PAUSE
DELAY_US·SUB·2, 2, Word, Word·' shell for PAUSEUS
GET_REQUESTS·SUB·1,1,Byte
GET_DIR··SUB·0
ISR_Start:
·WKPND_B=tmp
ISR_Exit:
WKEN_B = %10011110····'enable interrupt @ pin 0,5,6 (fork, Maint1,Maint2)
· RETURNINT
' =========================================================================
· PROGRAM Start
' =========================================================================
Start:
Main:
tmp=0
do
·que(tmp)=no_req
·inc tmp
loop until tmp=16
GET_REQUESTS Int_Req
end
SUB·GET_REQUESTS
put temp, que(0) to que(15)
endsub
sub TX_byte
endsub
FUNC RX_byte
endfunc
sub LCD_INIT····' initialize LCD
endsub
sub LCD_BLIP····' blip LCD "E" pin
endsub
sub LCD_CMD····' send LCD command
endsub
sub LCD_OUT····' print char on LCD
endsub
sub LCD_STR····' print string on LCD
endsub
sub LCD_SET_CRSR···' set cursor mode
endsub
sub DELAY_MS··' shell for PAUSE
endsub
sub DELAY_US··' shell for PAUSEUS
endsub
sub GET_DIR
endsub
end
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Post Edited (SamTheMan) : 6/7/2009 10:20:26 AM GMT