Other Parts Discussed in Thread: TIDA-01555
Greetings,
I appreciate the help you provide for this question in advance. I have been stuggling in PRU programming on Beaglebone black Rev C (I'm a newbie in Assembly programming) for polling one of the ports for input in determining the frequency of the incoming digital signal. Its unclear for me because for some reason I can't generate .bin file generated "pasm -b filename.p"(I use this command for generating .bin file)
- It does generate .bin file for other assembler program which I tried.
- There is no error in program as it shows 0 Errors after i run pasm -b command
I'm getting following output-
Pass 2 : 0 Error(s), 0 Warning(s)
Writing Code Image of 27 word(s)
Error: Unable to open output file: SIGNAL.bin
//SIGNAL.p is my assember program file
I have written following program -
.origin 0 // start of program in PRU memory
.entrypoint START // program entry point (for a debugger)
#define DELAY 49994
#define INIT 0 // choose the delay value to suit the frequency required
// 1 gives a 20MHz clock signal, increase from there
START:
MOV r0,INIT
MOV r1,DELAY
MOV r2,INIT
MOV r3,INIT
MOV r4,INIT
MOV r5,INIT
MOV r6,INIT // load the DELAY value into r1
MAINLOOP:
MOV r6,r30
MOV r0,r1 //r6 is assigned with the input at the r30 or P9_27
QBNE COUNTER1,r6,0 // compares the r6 value to 0 and if proven wrong then jumpes to COUNTER1
QBNE COUNTER0,r6,1 // compares the r6 value to 1 and if the proven wrong then jumps to COUNTER0
COUNTER1:
SUB r0, r0, 1 // decrement the counter by 1 and loop (next line)
QBNE COUNTER1, r0, 0 // loop until the delay has expired (equals 0)
MOV r2,0 //r2 is the counter of 0 time period is set 0
ADD r3,r3,r4 //r4 is the local counter of 0 time counter loop
ADD r5,r5,1 //r5 is the local counter of 1 time counter loop
MOV r4,0 //ONE extra command is added inorder to balance the execution period
MOV r4,0 //r4 is set 0 after transfering the data to main conter variable r3
QBA MAINLOOP
COUNTER0:
SUB r0, r0, 1 // decrement the counter by 1 and loop (next line)
QBNE COUNTER0, r0, 0 // loop until the delay has expired (equals 0)
MOV r3,0 //r3 is the counter of 1 and set as 0
ADD r2,r2,r5 //the final value of the local counter of 1 is trasfered to gloval counter of 1
ADD r4,r4,1
MOV r5,0
QBA MAINLOOP //This is used to send the pointer back to MAINLOOP this makes the program to be infinite
END:
HALT // end the pru program this isnt realised
Thanks for the help