Home
JAQForum Ver 20.06
Log In or Join  
Active Topics
Local Time 05:31 27 Apr 2024 Privacy Policy
Jump to

Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.

Forum Index : Microcontroller and PC projects : PASM12A question

Author Message
Volhout
Guru

Joined: 05/03/2018
Location: Netherlands
Posts: 3527
Posted: 06:10pm 10 May 2022
Copy link to clipboard 
Print this post

Hi Mick,

I am trying to compile a piece of PIO assembler, and PASM gives me strange results.
The code is in datablock:

the jmp's all compile to the same value despite they are different.

Any idea what I am doing wrong ?

'PASM 0.12a

'** Ref info for development reminder only ** - This block to be removed
'PIO(PINCTRL no_side_set_pins [,no_set_pins] [,no_out_pins] [,IN base] [,side_set_base] [,set_base])
'PIO(EXECCTRL jmp_pin ,wrap_target, wrap
'PIO(SHIFTCTRL push_threshold [,pull_threshold] [,autopush] [,autopull])
'PIO INIT MACHINE pio, statemachine, clockspeed, PINCTRL register, EXECCTRL register,
' SHIFTCTRL register

Option explicit

'PASM requires an output array and somewhere to put the EXECCTRL register
Dim pio1%(7)  'output array - unused area is padded with nop statements (&hA042).
Dim integer PINCTRL(3),EXECCTRL(3),SHIFTCTRL(3),CLKDIV(3)  'global state machine registers


'Note:
'Delimiters between parts of the commands can be a single space or a single comma.
'Multiple delimiters are not supported and those instructions will not assemble correctly.
'Data to be assembled must finish with a null data string i.e. DATA ""

'Directives - .word <word> / .origin / .wrap target / .wrap
'Pseudoinstructions - .nop (assembles as mov y,y)

datablock:                  'marks the beginning of the data block
Data ".origin 0"            'origin will almost always be 0 to run from start of memory
Data ".wrap target"         'outer loop (runs forever)
Data "set X, 0"             '0 clear counter
Data "jmp pin 3"            '1 when pin=0 continue counting
Data "jmp X-- 1"            '2 count down
Data "jmp X-- 4"            '3 count down
Data "jmp pin 3"            '4 when pin=0 continue counting
Data "mov X osr"            '5 move count to output register
Data "push noblock"         '6 push it into the fifo
Data ".wrap"                'and repeat
Data ""                     'use "" to mark last data statement in the block

initrp                       'initialise the state machine registers to default values
PASM "datablock",pio1%(),0   'assemble the prog - data block label, output array, state machine
fileman("s","testfile")      'save the file "testfile.PIO" to the SD card
End

etc... etc ....



It looks as if the jump addresses are not compiled correctly...
Edited 2022-05-11 04:30 by Volhout
PicomiteVGA PETSCII ROBOTS
 
Mixtel90

Guru

Joined: 05/10/2019
Location: United Kingdom
Posts: 5726
Posted: 06:22pm 10 May 2022
Copy link to clipboard 
Print this post

Try it using *either* a space *or* a comma as a delimiter. Unfortunately it falls over if you use both. :)

Something I never did manage to sort out...  :(
Mick

Zilog Inside! nascom.info for Nascom & Gemini
Preliminary MMBasic docs & my PCB designs
 
Volhout
Guru

Joined: 05/03/2018
Location: Netherlands
Posts: 3527
Posted: 10:28am 11 May 2022
Copy link to clipboard 
Print this post

@Peter, Mick,

I am trying to get the PIO working with the current software (5.07.04) and have not succeeded yet. Is there anyone who can try to run the example in Geoff's manual on page 145, and confirm it is working ?

Dim a%(7)=(&H0001E000E101E081,0,0,0,0,0,0,0) 'This is the actual program
SetPin 1,pio0 'Pin 1 is allocated to pio0
PIO program 0,a%() 'pio0 will run the program stored in a%()
PIO init machine 0,0,100000 'Initialise pio0, state machine 0 to run at 100000Hz
'note that PINCTRL, EXECCTRL & SHIFTCTRL are not
'changed in this example.
PIO start 0,0 'Start pio0, state machine 0


I have used a new (fresh programmed (first nuked)) pico, and tried this sample program. I do not get the square wave at GP0 (pin1).
I am using a standard picomite (not VGA picomite) since the VGA version uses PIO0 for VGA.

Not sure weather the problem lies with the PINCTRL (what pins can be set by PIO), EXECCTRL (contains the .wrap adresses) or SHIFTCTRL (we're not shifting...).
Edited 2022-05-11 20:35 by Volhout
PicomiteVGA PETSCII ROBOTS
 
Print this page


To reply to this topic, you need to log in.

© JAQ Software 2024