(Nios 2/Altera DE2 using Assembly) Why doesn't my lego controller motor receive the values from the sensor for self balancing robot? -
i computer science pupil , working on lab school. have been trying create work, no avail. far, happens motor runs forwards without stopping. connected sensor led's on de2 board see if able receive , store values correctly, , seems case. however, motor not running in correspondence sensor. have been tinkering around code hours no luck. assembly programming noob , shall appreciate help this.
i have attached code here:
.equ addr, 0x10000070 .equ ledr, 0x10000000 .equ ledg, 0x10000010
.global main
main:
movia r22, ledr movia r23, ledg movia r8, addr movia r9, 0x07f557ff stwio r9, 4(r8)
sensor1:
movia r9, 0xfffffbff stwio r9, 0(r8)
loop1:
ldwio r5, 0(r8) srli r5, r5, 11 andi r5, r5, 0x1 bne r5, r0, loop1 ldwio r10, 0(r8) srli r10, r10, 27 andi r10, r10, 0x0f stwio r10, 0(r22)
sensor2:
movia r9, 0xffffefff stwio r9, 0(r8)
loop2:
ldwio r6, 0(r8) srli r6, r6, 13 andi r6, r6, 0x1 bne r6, r0, loop2 ldwio r11, 0(r8) srli r11, r11, 27 andi r11, r11, 0x0f stwio r11, 0(r23)
motor:
/*beq r10, r11, motoroff*/ blt r10, r11, motorr movia r15, 0xfffffffc stwio r15, 0(r8) br sensor1
motorr:
movia r15, 0xfffffffe stwio r15, 0(r8) br sensor1
.end
and here link lego controller manual:
http://www-ug.eecg.toronto.edu/msl/nios_devices/dev_newlegocontroller2.html
i trying create work now, , later have utilize pulse width modulation create more accurate... might have utilize nios2 timer?
i lost , shall appreciate help.
thanks lot guys, appreciate it.
manik
thanks lot, think have been spending much time on , needs fresh pair of eyes help me.
assembly robot altera lego nios
No comments:
Post a Comment