Unsubscribe

2022-07-01 Thread josh

Good bye josh  :-(
You are now unsubscribed




--
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe


Re: Why won't the LED flash?

2015-12-20 Thread Josh
Okay so I feel like an idiot for not figuring this out earlier, but I'll 
put it down to not writing picolisp before. Anyways, I figured out what 
is wrong, sbcl if statement works like so:


 (if test-form then-form else-form)

And the Picolisp works the same, and the easiest way to do multiple 
things in the "then-form" is with progn on SBCL, or prog on Picolisp :/ 
so the correct code to get it to blink is:


# A simple program which demonstrates
# the usage of user-buttons.
 
# declare pins

(setq led 'PB_29 button 'PX_16)

# a simple delay function
(de delay (t)
   (tmr-delay 0 t) )

# make sure the LED starts in
# the "off" position and enable
# input/output pins
(de init-pins ()
   (pio-pin-sethigh led)
   (pio-pin-setdir *pio-output* led)
   (pio-pin-setdir *pio-input* button) )

# And now, the main loop
(de prog-loop ()
   (init-pins)
   (loop
  (if (= 0 (pio-pin-getval button))
(prog (pio-pin-setlow led)
  (delay 10)
  (pio-pin-sethigh led)
  (delay 10) ) ) ) )

(prog-loop)


*drops mic*
anyways, I got it working using that exact code, I've edited the wiki book.
*picks up mic and drops it again*
Thanks :P


On 20/12/15 13:48, J B wrote:
No circuit just the plain old Mizar B. The Example from the hempl wiki 
book is flashing PB_29. I'm Ubuntu to  connect with terminal.


Sent from my iPhone

On Dec 20, 2015, at 12:12 PM, pd <mailto:eukel...@gmail.com>> wrote:


sorry if you already said this but what platform are you using? also 
a schematic of your circuit would be interesting even being so simple


On Sun, Dec 20, 2015 at 3:18 AM, Josh <mailto:k1llfre...@hotmail.co.uk>> wrote:


Thought it might be a firmware problem or something, so I just
re-flashed the firmware but it's still happening, just
eliminating possibilities. Also the second of my last emails was
the correct one, I canceled the previous but it sent anyways.
Thanks.


On 19/12/15 12:50, Josh wrote:

I have put the main code onto the sd card and I use the shell to
call the function prog-loop. The light just stays on. I've had
this problem before with the example blink program, if I change
any of it to make it shorter by using shorter function names
like (de low () (pio-pin-setlow 'PB_29)) it doesn't work, but it
does when it's just (pio-pijn-setlow 'PB_29). I don't really
know what's going on, but it's starting to get irritating.
On 19/12/15 03:45, Raman Gopalan wrote:


Dear Josh, greetings!

Firstly, great to know you're playing with your board! Perfect!

> Why does this small amount of code not make the onboard LED
flash?

I think you're not providing enough delay for you to see the
off state
of the LED. Why don't you try this? I've just inserted an
additional
delay.

(pio-pin-setdir *pio-output* 'PB_29)
(pio-pin-sethigh 'PB_29)

(loop
   (pio-pin-setlow 'PB_29)
   (tmr-delay 0 10)
   (pio-pin-sethigh 'PB_29)
   (tmr-delay 0 10) )

> Any ideas? Also this example on the hempl wiki book:

This example doesn't blink the on-board LED. It just reads the
status
of an input pin (SW-1 I think; the one near the voltage
regulator) and
turns the blue LED on when this input switch is pressed.

> # And now, the main loop
> (de prog-loop ()
>(init-pins)
>(loop
>   (if (= 0 (pio-pin-getval button))
>  (pio-pin-setlow led)
>  (delay 10)
>  (pio-pin-sethigh led)
>  (delay 10) ) ) )

Please copy the example on your micro-SD card and point picolisp in
the direction of this file. If this doesn't happen, something
strange
is happening. We can then debug. But I'm almost certain it'll
work :)

Hempl# picolisp /mmc/user-button.l

R

P.S. You may also use the internal transient symbol
`*tmr-sys-timer*'
in the function tmr-delay. I think it uses a hardware PWM
channel to
generate the time (can't remember which; I'll have to see the
sources
again). That makes the timing accurate.


On 18 December 2015 at 22:08, Josh mailto:k1llfre...@hotmail.couk>> wrote:

Why does this small amount of code not make the onboard LED
flash?
(pio-pin-setdir *pio-output* 'PB_29)
(pio-pin-sethigh 'PB_29)
(loop (pio-pin-setlow 'PB_29)
 (tmr-delay 0 10)
 (pio-pin-sethigh 'PB_29))
All that happens in the blue LED turns on and stays on,
even though the code clearly says for it to go from high to
low repeatedly. Any ideas? Also this example on the hempl
wiki book:

# A simple program

Re: Why won't the LED flash?

2015-12-19 Thread Josh
Thought it might be a firmware problem or something, so I just 
re-flashed the firmware but it's still happening, just eliminating 
possibilities. Also the second of my last emails was the correct one, I 
canceled the previous but it sent anyways. Thanks.


On 19/12/15 12:50, Josh wrote:
I have put the main code onto the sd card and I use the shell to call 
the function prog-loop. The light just stays on. I've had this problem 
before with the example blink program, if I change any of it to make 
it shorter by using shorter function names like (de low () 
(pio-pin-setlow 'PB_29)) it doesn't work, but it does when it's just 
(pio-pijn-setlow 'PB_29). I don't really know what's going on, but 
it's starting to get irritating.

On 19/12/15 03:45, Raman Gopalan wrote:


Dear Josh, greetings!

Firstly, great to know you're playing with your board! Perfect!

> Why does this small amount of code not make the onboard LED flash?

I think you're not providing enough delay for you to see the off state
of the LED. Why don't you try this? I've just inserted an additional
delay.

(pio-pin-setdir *pio-output* 'PB_29)
(pio-pin-sethigh 'PB_29)

(loop
   (pio-pin-setlow 'PB_29)
   (tmr-delay 0 10)
   (pio-pin-sethigh 'PB_29)
   (tmr-delay 0 10) )

> Any ideas? Also this example on the hempl wiki book:

This example doesn't blink the on-board LED. It just reads the status
of an input pin (SW-1 I think; the one near the voltage regulator) and
turns the blue LED on when this input switch is pressed.

> # And now, the main loop
> (de prog-loop ()
>(init-pins)
>(loop
>   (if (= 0 (pio-pin-getval button))
>  (pio-pin-setlow led)
>  (delay 10)
>  (pio-pin-sethigh led)
>  (delay 10) ) ) )

Please copy the example on your micro-SD card and point picolisp in
the direction of this file. If this doesn't happen, something strange
is happening. We can then debug. But I'm almost certain it'll work :)

Hempl# picolisp /mmc/user-button.l

R

P.S. You may also use the internal transient symbol `*tmr-sys-timer*'
in the function tmr-delay. I think it uses a hardware PWM channel to
generate the time (can't remember which; I'll have to see the sources
again). That makes the timing accurate.


On 18 December 2015 at 22:08, Josh <mailto:k1llfre...@hotmail.couk>> wrote:


Why does this small amount of code not make the onboard LED flash?
(pio-pin-setdir *pio-output* 'PB_29)
(pio-pin-sethigh 'PB_29)
(loop (pio-pin-setlow 'PB_29)
 (tmr-delay 0 10)
 (pio-pin-sethigh 'PB_29))
All that happens in the blue LED turns on and stays on, even
though the code clearly says for it to go from high to low
repeatedly. Any ideas? Also this example on the hempl wiki book:

# A simple program which demonstrates
# the usage of user-buttons.
 # declare pins
(setq led 'PB_29 button 'PX_16)

# a simple delay function
(de delay (t)
   (tmr-delay 0 t) )

# make sure the LED starts in
# the "off" position and enable
# input/output pins
(de init-pins ()
   (pio-pin-sethigh led)
   (pio-pin-setdir *pio-output* led)
   (pio-pin-setdir *pio-input* button) )

# And now, the main loop
(de prog-loop ()
   (init-pins)
   (loop
  (if (= 0 (pio-pin-getval button))
 (pio-pin-setlow led)
 (delay 10)
 (pio-pin-sethigh led)
 (delay 10) ) ) )

(prog-loop)

Doesn't make the LED flash it just stays on.

-- 
UNSUBSCRIBE: mailto:picolisp@software-lab.de

<mailto:picolisp@software-lab.de>?subject=Unsubscribe








Re: Why won't the LED flash?

2015-12-19 Thread Josh
I have put the main code onto the sd card and I use the shell to call 
the function prog-loop. The light just stays on. I've had this problem 
before with the example blink program, if I change any of it to make it 
shorter by using shorter function names like (de low () (pio-pin-setlow 
'PB_29)) it doesn't work, but it does when it's just (pio-pijn-setlow 
'PB_29). I don't really know what's going on, but it's starting to get 
irritating.

On 19/12/15 03:45, Raman Gopalan wrote:


Dear Josh, greetings!

Firstly, great to know you're playing with your board! Perfect!

> Why does this small amount of code not make the onboard LED flash?

I think you're not providing enough delay for you to see the off state
of the LED. Why don't you try this? I've just inserted an additional
delay.

(pio-pin-setdir *pio-output* 'PB_29)
(pio-pin-sethigh 'PB_29)

(loop
   (pio-pin-setlow 'PB_29)
   (tmr-delay 0 10)
   (pio-pin-sethigh 'PB_29)
   (tmr-delay 0 10) )

> Any ideas? Also this example on the hempl wiki book:

This example doesn't blink the on-board LED. It just reads the status
of an input pin (SW-1 I think; the one near the voltage regulator) and
turns the blue LED on when this input switch is pressed.

> # And now, the main loop
> (de prog-loop ()
>(init-pins)
>(loop
>   (if (= 0 (pio-pin-getval button))
>  (pio-pin-setlow led)
>  (delay 10)
>  (pio-pin-sethigh led)
>  (delay 10) ) ) )

Please copy the example on your micro-SD card and point picolisp in
the direction of this file. If this doesn't happen, something strange
is happening. We can then debug. But I'm almost certain it'll work :)

Hempl# picolisp /mmc/user-button.l

R

P.S. You may also use the internal transient symbol `*tmr-sys-timer*'
in the function tmr-delay. I think it uses a hardware PWM channel to
generate the time (can't remember which; I'll have to see the sources
again). That makes the timing accurate.


On 18 December 2015 at 22:08, Josh <mailto:k1llfre...@hotmail.couk>> wrote:


Why does this small amount of code not make the onboard LED flash?
(pio-pin-setdir *pio-output* 'PB_29)
(pio-pin-sethigh 'PB_29)
(loop (pio-pin-setlow 'PB_29)
 (tmr-delay 0 10)
 (pio-pin-sethigh 'PB_29))
All that happens in the blue LED turns on and stays on, even
though the code clearly says for it to go from high to low
repeatedly. Any ideas? Also this example on the hempl wiki book:

# A simple program which demonstrates
# the usage of user-buttons.
 # declare pins
(setq led 'PB_29 button 'PX_16)

# a simple delay function
(de delay (t)
   (tmr-delay 0 t) )

# make sure the LED starts in
# the "off" position and enable
# input/output pins
(de init-pins ()
   (pio-pin-sethigh led)
   (pio-pin-setdir *pio-output* led)
   (pio-pin-setdir *pio-input* button) )

# And now, the main loop
(de prog-loop ()
   (init-pins)
   (loop
  (if (= 0 (pio-pin-getval button))
 (pio-pin-setlow led)
 (delay 10)
 (pio-pin-sethigh led)
 (delay 10) ) ) )

(prog-loop)

Doesn't make the LED flash it just stays on.

-- 
UNSUBSCRIBE: mailto:picolisp@software-lab.de

<mailto:picolisp@software-lab.de>?subject=Unsubscribe






Re: Why won't the LED flash?

2015-12-19 Thread Josh
I have put the main code onto the sd card and I use the shell to call 
the function prog-loop. The light just stays on. I've had this problem 
before with the example blink program, if I change any of it to make it 
shorter by using shorter function names like (setq low (pio-pin-setlow 
'PB_29)) it doesn't work, when logically it meets the syntax and makes 
sense.


On 19/12/15 03:45, Raman Gopalan wrote:


Dear Josh, greetings!

Firstly, great to know you're playing with your board! Perfect!

> Why does this small amount of code not make the onboard LED flash?

I think you're not providing enough delay for you to see the off state
of the LED. Why don't you try this? I've just inserted an additional
delay.

(pio-pin-setdir *pio-output* 'PB_29)
(pio-pin-sethigh 'PB_29)

(loop
   (pio-pin-setlow 'PB_29)
   (tmr-delay 0 10)
   (pio-pin-sethigh 'PB_29)
   (tmr-delay 0 10) )

> Any ideas? Also this example on the hempl wiki book:

This example doesn't blink the on-board LED. It just reads the status
of an input pin (SW-1 I think; the one near the voltage regulator) and
turns the blue LED on when this input switch is pressed.

> # And now, the main loop
> (de prog-loop ()
>(init-pins)
>(loop
>   (if (= 0 (pio-pin-getval button))
>  (pio-pin-setlow led)
>  (delay 10)
>  (pio-pin-sethigh led)
>  (delay 10) ) ) )

Please copy the example on your micro-SD card and point picolisp in
the direction of this file. If this doesn't happen, something strange
is happening. We can then debug. But I'm almost certain it'll work :)

Hempl# picolisp /mmc/user-button.l

R

P.S. You may also use the internal transient symbol `*tmr-sys-timer*'
in the function tmr-delay. I think it uses a hardware PWM channel to
generate the time (can't remember which; I'll have to see the sources
again). That makes the timing accurate.


On 18 December 2015 at 22:08, Josh <mailto:k1llfre...@hotmail.couk>> wrote:


Why does this small amount of code not make the onboard LED flash?
(pio-pin-setdir *pio-output* 'PB_29)
(pio-pin-sethigh 'PB_29)
(loop (pio-pin-setlow 'PB_29)
 (tmr-delay 0 10)
 (pio-pin-sethigh 'PB_29))
All that happens in the blue LED turns on and stays on, even
though the code clearly says for it to go from high to low
repeatedly. Any ideas? Also this example on the hempl wiki book:

# A simple program which demonstrates
# the usage of user-buttons.
 # declare pins
(setq led 'PB_29 button 'PX_16)

# a simple delay function
(de delay (t)
   (tmr-delay 0 t) )

# make sure the LED starts in
# the "off" position and enable
# input/output pins
(de init-pins ()
   (pio-pin-sethigh led)
   (pio-pin-setdir *pio-output* led)
   (pio-pin-setdir *pio-input* button) )

# And now, the main loop
(de prog-loop ()
   (init-pins)
   (loop
  (if (= 0 (pio-pin-getval button))
 (pio-pin-setlow led)
 (delay 10)
 (pio-pin-sethigh led)
 (delay 10) ) ) )

(prog-loop)

Doesn't make the LED flash it just stays on.

-- 
UNSUBSCRIBE: mailto:picolisp@software-lab.de

<mailto:picolisp@software-lab.de>?subject=Unsubscribe






Re: Why won't the LED flash?

2015-12-18 Thread Josh
Thanks for the reply, but that time is 1/5th of the time for the 
blinking LED example, and 1/5th a second is enough for an eye to see. 
Anyways, this little bit:

>  (pio-pin-setlow led)
>  (delay 10)
>  (pio-pin-sethigh led)
>  (delay 10) ) ) )
Is exactly the same as the code from the "quick start" where it makes 
the LED blink, it only uses a shorter time period. Another thing, on the 
Hempl website where I copy and pasted the code, it says " We will read 
the pin connected to the onboard user button and, as long as it is 
pressed down, we will make the on-board LED flicker. I"



But it doesn't blink, I adjusted the times to make them five times 
higher and it just waits around 1 second and the LED turns on but 
doesn't blink like it should. Any ideas? It should blink, clearly 
setting it from on then off and looping it should blink, but it won't.


On 19/12/15 03:45, Raman Gopalan wrote:


Dear Josh, greetings!

Firstly, great to know you're playing with your board! Perfect!

> Why does this small amount of code not make the onboard LED flash?

I think you're not providing enough delay for you to see the off state
of the LED. Why don't you try this? I've just inserted an additional
delay.

(pio-pin-setdir *pio-output* 'PB_29)
(pio-pin-sethigh 'PB_29)

(loop
   (pio-pin-setlow 'PB_29)
   (tmr-delay 0 10)
   (pio-pin-sethigh 'PB_29)
   (tmr-delay 0 10) )

> Any ideas? Also this example on the hempl wiki book:

This example doesn't blink the on-board LED. It just reads the status
of an input pin (SW-1 I think; the one near the voltage regulator) and
turns the blue LED on when this input switch is pressed.

> # And now, the main loop
> (de prog-loop ()
>(init-pins)
>(loop
>   (if (= 0 (pio-pin-getval button))
>  (pio-pin-setlow led)
>  (delay 10)
>  (pio-pin-sethigh led)
>  (delay 10) ) ) )

Please copy the example on your micro-SD card and point picolisp in
the direction of this file. If this doesn't happen, something strange
is happening. We can then debug. But I'm almost certain it'll work :)

Hempl# picolisp /mmc/user-button.l

R

P.S. You may also use the internal transient symbol `*tmr-sys-timer*'
in the function tmr-delay. I think it uses a hardware PWM channel to
generate the time (can't remember which; I'll have to see the sources
again). That makes the timing accurate.


On 18 December 2015 at 22:08, Josh <mailto:k1llfre...@hotmail.couk>> wrote:


Why does this small amount of code not make the onboard LED flash?
(pio-pin-setdir *pio-output* 'PB_29)
(pio-pin-sethigh 'PB_29)
(loop (pio-pin-setlow 'PB_29)
 (tmr-delay 0 10)
 (pio-pin-sethigh 'PB_29))
All that happens in the blue LED turns on and stays on, even
though the code clearly says for it to go from high to low
repeatedly. Any ideas? Also this example on the hempl wiki book:

# A simple program which demonstrates
# the usage of user-buttons.
 # declare pins
(setq led 'PB_29 button 'PX_16)

# a simple delay function
(de delay (t)
   (tmr-delay 0 t) )

# make sure the LED starts in
# the "off" position and enable
# input/output pins
(de init-pins ()
   (pio-pin-sethigh led)
   (pio-pin-setdir *pio-output* led)
   (pio-pin-setdir *pio-input* button) )

# And now, the main loop
(de prog-loop ()
   (init-pins)
   (loop
  (if (= 0 (pio-pin-getval button))
 (pio-pin-setlow led)
 (delay 10)
 (pio-pin-sethigh led)
 (delay 10) ) ) )

(prog-loop)

Doesn't make the LED flash it just stays on.

-- 
UNSUBSCRIBE: mailto:picolisp@software-lab.de

<mailto:picolisp@software-lab.de>?subject=Unsubscribe






Why won't the LED flash?

2015-12-18 Thread Josh

Why does this small amount of code not make the onboard LED flash?
(pio-pin-setdir *pio-output* 'PB_29)
(pio-pin-sethigh 'PB_29)
(loop (pio-pin-setlow 'PB_29)
 (tmr-delay 0 10)
 (pio-pin-sethigh 'PB_29))
All that happens in the blue LED turns on and stays on, even though the 
code clearly says for it to go from high to low repeatedly. Any ideas? 
Also this example on the hempl wiki book:


# A simple program which demonstrates
# the usage of user-buttons.
 
# declare pins

(setq led 'PB_29 button 'PX_16)

# a simple delay function
(de delay (t)
   (tmr-delay 0 t) )

# make sure the LED starts in
# the "off" position and enable
# input/output pins
(de init-pins ()
   (pio-pin-sethigh led)
   (pio-pin-setdir *pio-output* led)
   (pio-pin-setdir *pio-input* button) )

# And now, the main loop
(de prog-loop ()
   (init-pins)
   (loop
  (if (= 0 (pio-pin-getval button))
 (pio-pin-setlow led)
 (delay 10)
 (pio-pin-sethigh led)
 (delay 10) ) ) )

(prog-loop)

Doesn't make the LED flash it just stays on.

--
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe


Re: Mizar32 - What order do functions have to appear?

2015-12-17 Thread Josh

Scratch that, I hit enter and it worked.

On 17/12/15 21:14, Josh wrote:
Sorry for waiting so long before replying. I have moved to Linux, I 
have installed Picolisp and installed minicom but running minicom just 
returns "minicom: cannot open /dev/ttyACM0: No such file or directory" 
what do I do about this? Thanks.


On 03/12/15 12:25, J B wrote:
Thanks for the quick reply. I'm not using Linux, my Mizar lives at 
college where I am building my project for college. The college PC's 
are using Win 7 and I don't think they have any terminal software 
installed on them, although HyperTerm is installed by default, it's 
probably blocked as I can't find it. I may be able to get hyperterm 
unblocked or bring in a portable terminal emulator on a usb stick, 
but I'm not sure. Do I need any special cables for the emulator or is 
it just the USB power cable? Also, once that's set up how do I invoke 
Picolisp? Thanks.



From: ramangopa...@gmail.com
To: picolisp@software-lab.de
Subject: Re: Mizar32 - What order do functions have to appear?
Date: Wed, 2 Dec 2015 03:30:10 +0100


Dear JB, greetings!

> So I started creating a little program to act as a digital counter
> with the blue led flashing at each change of logic state, it came to

Perfect way to begin!

> my attention very quickly that there is some hidden format that the
> code has to be in and some rules that I can’t find written. It seems

Actually, nothing is hidden or implicit at all. :) So, let's fix your
problem for you.

> to me that you can’t set a pin direction unless you are going to use
> it in the immediate program and I personally can’t seem to get
> smaller functions of “sethigh” and “setlow” to ever work.

You can set the direction of a pin in any context in PicoLisp. The
code you have in autorun.l must set its direction. Here's how it
works. Think of it as the default state of the pin. Some pins can be
high by default; some can be low. This is MCU specific - This
particular device works this way. The same code on an LM3S8962 Texas
Instruments Cortex clone behaves the other way.

# Will set the dir of PB_29 and turn the blue LED "on"
# automatically.
(pio-pin-setdir *pio-output* 'PB_29)

# Will turn the blue LED "off".
(pio-pin-sethigh 'PB_29)

So, your function should be:

(de high (pin)
   (pio-pin-setlow pin) )

> Is there like a comprehensive list of the way I need to be writing
> these programs?

It's regular PicoLisp. No different. Just that it runs on the MCU. :)

> I experiment a lot and I do not have the vga board so I have no
> console on screen, I’m kinda running blind and need all the heads up
> I can.

Oh! This is quite easy. Can you please use a serial terminal emulator?
I use minicom. It's a nice tool. In case you don't have it, please get
it (or another of your choice) and configure it for 115200 baud, 8N1
and no hardware flow control. So, assuming an Ubuntu GNU/Linux and
minicom:

$ sudo apt-get install minicom
$ minicom -D /dev/ttyACM0

The above should get you the Hempl shell. Invoke PicoLisp directly
from the shell. You can then type away interactively - like you would
with regular PicoLisp. You can also edit PicoLisp files on your SD
card using iv, the vi clone.

Hempl# iv /mmc/autorun.l
Hempl# picolisp /mmc/autorun.l

Please let me know if this helps you. Good luck!

R

On 1 December 2015 at 23:08, J B <mailto:k1llfre...@hotmail.co.uk>> wrote:


So I started creating a little program to act as a digital
counter with the blue led flashing at each change of logic state,
it came to my attention very quickly that there is some hidden
format that the code has to be in and some rules that I can’t
find written. It seems to me that you can’t set a pin direction
unless you are going to use it in the immediate program and I
personally can’t seem to get smaller functions of “sethigh” and
“setlow” to ever work. Is there like a comprehensive list of the
way I need to be writing these programs? I experiment a lot and I
do not have the vga board so I have no console on screen, I’m
kinda running blind and need all the heads up I can. Thanks.








Re: Mizar32 - What order do functions have to appear?

2015-12-17 Thread Josh
Sorry for waiting so long before replying. I have moved to Linux, I have 
installed Picolisp and installed minicom but running minicom just 
returns "minicom: cannot open /dev/ttyACM0: No such file or directory" 
what do I do about this? Thanks.


On 03/12/15 12:25, J B wrote:
Thanks for the quick reply. I'm not using Linux, my Mizar lives at 
college where I am building my project for college. The college PC's 
are using Win 7 and I don't think they have any terminal software 
installed on them, although HyperTerm is installed by default, it's 
probably blocked as I can't find it. I may be able to get hyperterm 
unblocked or bring in a portable terminal emulator on a usb stick, but 
I'm not sure. Do I need any special cables for the emulator or is it 
just the USB power cable? Also, once that's set up how do I invoke 
Picolisp? Thanks.



From: ramangopa...@gmail.com
To: picolisp@software-lab.de
Subject: Re: Mizar32 - What order do functions have to appear?
Date: Wed, 2 Dec 2015 03:30:10 +0100


Dear JB, greetings!

> So I started creating a little program to act as a digital counter
> with the blue led flashing at each change of logic state, it came to

Perfect way to begin!

> my attention very quickly that there is some hidden format that the
> code has to be in and some rules that I can’t find written. It seems

Actually, nothing is hidden or implicit at all. :) So, let's fix your
problem for you.

> to me that you can’t set a pin direction unless you are going to use
> it in the immediate program and I personally can’t seem to get
> smaller functions of “sethigh” and “setlow” to ever work.

You can set the direction of a pin in any context in PicoLisp. The
code you have in autorun.l must set its direction. Here's how it
works. Think of it as the default state of the pin. Some pins can be
high by default; some can be low. This is MCU specific - This
particular device works this way. The same code on an LM3S8962 Texas
Instruments Cortex clone behaves the other way.

# Will set the dir of PB_29 and turn the blue LED "on"
# automatically.
(pio-pin-setdir *pio-output* 'PB_29)

# Will turn the blue LED "off".
(pio-pin-sethigh 'PB_29)

So, your function should be:

(de high (pin)
   (pio-pin-setlow pin) )

> Is there like a comprehensive list of the way I need to be writing
> these programs?

It's regular PicoLisp. No different. Just that it runs on the MCU. :)

> I experiment a lot and I do not have the vga board so I have no
> console on screen, I’m kinda running blind and need all the heads up
> I can.

Oh! This is quite easy. Can you please use a serial terminal emulator?
I use minicom. It's a nice tool. In case you don't have it, please get
it (or another of your choice) and configure it for 115200 baud, 8N1
and no hardware flow control. So, assuming an Ubuntu GNU/Linux and
minicom:

$ sudo apt-get install minicom
$ minicom -D /dev/ttyACM0

The above should get you the Hempl shell. Invoke PicoLisp directly
from the shell. You can then type away interactively - like you would
with regular PicoLisp. You can also edit PicoLisp files on your SD
card using iv, the vi clone.

Hempl# iv /mmc/autorun.l
Hempl# picolisp /mmc/autorun.l

Please let me know if this helps you. Good luck!

R

On 1 December 2015 at 23:08, J B > wrote:


So I started creating a little program to act as a digital counter
with the blue led flashing at each change of logic state, it came
to my attention very quickly that there is some hidden format that
the code has to be in and some rules that I can’t find written. It
seems to me that you can’t set a pin direction unless you are
going to use it in the immediate program and I personally can’t
seem to get smaller functions of “sethigh” and “setlow” to ever
work. Is there like a comprehensive list of the way I need to be
writing these programs? I experiment a lot and I do not have the
vga board so I have no console on screen, I’m kinda running blind
and need all the heads up I can. Thanks.