Prop2 ES Eval Board. Trying to blink P56 LED using PNUT v33L. Not working...
Bean
Posts: 8,129
I am trying to simply blink the LED on P56.
I press F11 and it downloads the code and P60 and P61 LEDs come on briefly, but then nothing.
Is there a jumper I must install ?
Thanks for any help,
Bean
I press F11 and it downloads the code and P60 and P61 LEDs come on briefly, but then nothing.
CON basepin=32 oscmode = $010c3f04 freq = 160_000_000 PUB Main dirb[56] := 1 repeat outb[56] := 1 waitcnt 80_000_000 + cnt outb[56] := 0 waitcnt 80_000_000 + cnt
Is there a jumper I must install ?
Thanks for any help,
Bean
Comments
FlexGUI/fastspin is the direction to look in - https://forums.parallax.com/discussion/170730/flexgui-4-0-3-a-complete-programming-system-for-p2-and-p1/p1
You can compile and run your example using FlexGUI, except that you'll have to put brackets around the parameter to the waitcnt() call. Also, it'll be running at RCFAST speed (around 20 MHz) since there's no explicit clkset() call.
You could also do something similar in BASIC as:
if you plug your "Control" addon board at #24
but this doesn't:
PNut_v33L doesn't do Spin2, yet, but the compiler is able to process some Spin2 source. It's a work-in-progress that is not functional, yet, so I haven't said anything about it. It's kind of funny they it gave the appearance that it might be working.
I'll try doing it in PASM with PNut.
I don't have the "CONTROL" board, I'm just trying it with the LEDs on the Eval board.
Thanks for the quick replies...
Bean
https://github.com/totalspectrum/flexgui/blob/master/samples/blink_pasm.spin2
Bean
WAITX ##$20_000_000
If you set the crystal then change 20_ to your clock frequency to give 1 second
There is a clock setting rxample in the P2 Tricks and Traps thread
Postedit: fix waitx
Okay, what does the double # mean ? That is a new one on me...
Bean
Double # means add an AUGS (or AUGD) prefix to allow for a longer immediate value. So: is translated automatically by the assembler into something like
This two instruction sequence will wait for 20 million cycles.
(Note there was a typo in Cluso's original post, the instruction is "WAITX" and not "WAIT")
Double # is pretty handy, particularly in hubexec code, but one does have to be aware that it takes an extra instruction.
The leds on the Eval boards are active low. Use OUTL #56 instead.
Here is what I ended up with...
Bean
Why don’t you let the compiler do the work, and its easier to see too?
clkinit1 long 25_000_000 / 2 * 25 * 1 ‘250MHz???
clkinit1 long 20_000_000 / 2 * 25 * 1 ‘=250MHz
And BTW thats not 250MHz, its 312.5
You haven't exactly got it right yourself! I don't see any reference to 25 MHz in Bean's code.
Thats what I get from using an iPhone where I cannot see everything on a big screen
It was 20MHz here
clkinit1 LONG %1_000001_0000011000_1111_10_00 '20MHz/2*25*1 = 250MHz (setup)
which is of course 250MHz
However, now I can see the whole thing better...
@Bean,
Take a look at the P2 Tricks and Traps thread for a better way to setup the P2 clock.