• USB card adapters crash Pi4

    From bob prohaska@3:770/3 to All on Fri Jan 1 20:53:25 2021
    Just tried using a couple of USB card adapters with my 8GB Pi4.
    Both cause immediate loss of USB hard disk access. Unplugging
    the offending adapter does not restore normal operation. Power
    cycling puts matters right without apparent ill effect.

    Doesn't seem to matter if there's a card in the adapter or not.

    The USB3-Sata adapter is a Sabrent EC-UASP. It uses the UAS
    driver and hasn't caused any obvious problems on its own.

    Anybody seen this, or have any idea what's going on? The card
    adapters are fairly generic. Both are USB3, both have been used
    before, but only in USB2 ports on Pi3's. One is no-name large-
    and micro-SD only, the other is a UGreen card reader supporting TF,
    SD, CF and MS cards. The slot labeled TF is the one I used with
    microSD cards, didn't notice the "TF" marking till just now.

    Thanks for reading!

    bob prohaska

    --- SoupGate-Win32 v1.05
    * Origin: Agency HUB, Dunedin - New Zealand | Fido<>Usenet Gateway (3:770/3)
  • From Nikolaj Lazic@3:770/3 to All on Fri Jan 1 23:32:43 2021
    Dana Fri, 1 Jan 2021 20:53:25 -0000 (UTC), bob prohaska <bp@www.zefox.net> napis'o:
    Just tried using a couple of USB card adapters with my 8GB Pi4.
    Both cause immediate loss of USB hard disk access. Unplugging
    the offending adapter does not restore normal operation. Power
    cycling puts matters right without apparent ill effect.

    Not enough power?

    --- SoupGate-Win32 v1.05
    * Origin: Agency HUB, Dunedin - New Zealand | Fido<>Usenet Gateway (3:770/3)
  • From Martin Gregorie@3:770/3 to Nikolaj Lazic on Sat Jan 2 00:52:59 2021
    On Fri, 01 Jan 2021 23:32:43 +0000, Nikolaj Lazic wrote:

    Dana Fri, 1 Jan 2021 20:53:25 -0000 (UTC), bob prohaska
    <bp@www.zefox.net> napis'o:
    Just tried using a couple of USB card adapters with my 8GB Pi4.
    Both cause immediate loss of USB hard disk access. Unplugging the
    offending adapter does not restore normal operation. Power cycling puts
    matters right without apparent ill effect.

    Not enough power?

    From your description it sounds as if you're booting with the adapters disconnected and the hangup occurs when one or both are connected to the
    Pi. Is that what happened?

    Do they work correctly when used together on another computer?

    Have you got a multimeter, osscilloscope or any other way to check the
    Pi's supply voltage?

    -------
    I tend to keep a Pi power cable modified so I can measure the voltage
    across it. I run the cable through a small plastic box with terminals on
    the lid, the terminals are type used on oscilloscopes or multimeters for connecting test probes. These are worth using because they're difficult
    to short accidentally. The terminals on the box are connected to the red
    and black wires in the power cable. So that putting a multimeter or
    'scope across them lets you monitor the supply voltage going into the Pi.
    I sometimes put two terminals in series on the red cable with an on/off
    switch on the bit of wire between the 'red' terminals: this makes current measurement easy: turn the switch off and connect a meter on the two 'red terminals to measure current. Don't wanna measure current? disconnect
    meter from red terminals and turn the switch on. You mightn't use this
    gadget very often, but boy is it useful to have one when you suddenly
    need to check voltage or current in a USB terminated cable.

    Farnell, Conrad and similar outfits sell suitable boxes and terminals as
    well as soldering irons and multimeters


    --
    --
    Martin | martin at
    Gregorie | gregorie dot org

    --- SoupGate-Win32 v1.05
    * Origin: Agency HUB, Dunedin - New Zealand | Fido<>Usenet Gateway (3:770/3)
  • From bob prohaska@3:770/3 to Martin Gregorie on Sat Jan 2 02:13:44 2021
    Martin Gregorie <martin@mydomain.invalid> wrote:
    On Fri, 01 Jan 2021 23:32:43 +0000, Nikolaj Lazic wrote:

    Dana Fri, 1 Jan 2021 20:53:25 -0000 (UTC), bob prohaska
    <bp@www.zefox.net> napis'o:
    Just tried using a couple of USB card adapters with my 8GB Pi4.
    Both cause immediate loss of USB hard disk access. Unplugging the
    offending adapter does not restore normal operation. Power cycling puts
    matters right without apparent ill effect.

    Not enough power?

    From your description it sounds as if you're booting with the adapters disconnected and the hangup occurs when one or both are connected to the
    Pi. Is that what happened?

    One adapter at a time, yes.

    Do they work correctly when used together on another computer?

    They did when plugged into Pi3's, both under FreeBSD and RaspiOS

    Have you got a multimeter, osscilloscope or any other way to check the
    Pi's supply voltage?

    It never crossed my mind that power might be an issue.
    The power supply is a 3.5 amp unit from CanaKit. I suppose it's
    possible I'm on the edge, but you'd think that would cause boot
    troubles. I'll cobble up some test leads and check. No 'scope,
    alas, but I do have a voltmeter. That limits the utility of
    the measurement for transients. Hard to believe the puny little
    adapter could make trouble while spinning up the disk is ok.
    But it wouldn't be the first power supply to take sick on me.

    -------
    I tend to keep a Pi power cable modified so I can measure the voltage
    across it. I run the cable through a small plastic box with terminals on
    the lid, the terminals are type used on oscilloscopes or multimeters for connecting test probes. These are worth using because they're difficult
    to short accidentally. The terminals on the box are connected to the red
    and black wires in the power cable. So that putting a multimeter or
    'scope across them lets you monitor the supply voltage going into the Pi.
    I sometimes put two terminals in series on the red cable with an on/off switch on the bit of wire between the 'red' terminals: this makes current measurement easy: turn the switch off and connect a meter on the two 'red terminals to measure current. Don't wanna measure current? disconnect
    meter from red terminals and turn the switch on. You mightn't use this
    gadget very often, but boy is it useful to have one when you suddenly
    need to check voltage or current in a USB terminated cable.

    My habit has been to probe the GPIO pins. I hope the problem doesn't
    become common enough to warrant a breakout box. Still it's a good idea.

    Thanks for writing!

    bob prohaska

    --- SoupGate-Win32 v1.05
    * Origin: Agency HUB, Dunedin - New Zealand | Fido<>Usenet Gateway (3:770/3)
  • From Jan Panteltje@3:770/3 to bp@www.zefox.net on Sat Jan 2 09:10:08 2021
    On a sunny day (Fri, 1 Jan 2021 20:53:25 -0000 (UTC)) it happened bob prohaska <bp@www.zefox.net> wrote in <rso244$fck$1@dont-email.me>:

    Just tried using a couple of USB card adapters with my 8GB Pi4.
    Both cause immediate loss of USB hard disk access. Unplugging
    the offending adapter does not restore normal operation. Power
    cycling puts matters right without apparent ill effect.

    Doesn't seem to matter if there's a card in the adapter or not.

    The USB3-Sata adapter is a Sabrent EC-UASP. It uses the UAS
    driver and hasn't caused any obvious problems on its own.

    Anybody seen this, or have any idea what's going on? The card
    adapters are fairly generic. Both are USB3, both have been used
    before, but only in USB2 ports on Pi3's. One is no-name large-
    and micro-SD only, the other is a UGreen card reader supporting TF,
    SD, CF and MS cards. The slot labeled TF is the one I used with
    microSD cards, didn't notice the "TF" marking till just now.

    Thanks for reading!

    bob prohaska

    I only have an old Sweex USB2 card adaptor, connecting it to my new Pi4
    via USB via a Sitecom powered hub keeps /dev/sda2 3.4 TB Toshiba drive running normally:

    from dmesg:
    [163901.835425] usb 1-1.2.2: new high-speed USB device number 7 using xhci_hcd [163901.967321] usb 1-1.2.2: New USB device found, idVendor=058f, idProduct=6362, bcdDevice= 1.00
    [163901.967343] usb 1-1.2.2: New USB device strings: Mfr=1, Product=2, SerialNumber=3
    [163901.967359] usb 1-1.2.2: Product: Mass Storage Device
    [163901.967375] usb 1-1.2.2: Manufacturer: Generic
    [163901.967390] usb 1-1.2.2: SerialNumber: 058F312D81B
    [163901.970217] usb-storage 1-1.2.2:1.0: USB Mass Storage device detected [163901.970771] scsi host1: usb-storage 1-1.2.2:1.0
    [163903.036487] scsi 1:0:0:0: Direct-Access Generic USB SD Reader 1.00 PQ: 0 ANSI: 0
    [163903.037241] sd 1:0:0:0: Attached scsi generic sg1 type 0
    [163903.038712] scsi 1:0:0:1: Direct-Access Generic USB CF Reader 1.01 PQ: 0 ANSI: 0
    [163903.039297] sd 1:0:0:1: Attached scsi generic sg2 type 0
    [163903.040713] scsi 1:0:0:2: Direct-Access Generic USB SM Reader 1.02 PQ: 0 ANSI: 0
    [163903.041273] scsi 1:0:0:2: Attached scsi generic sg3 type 0
    [163903.043009] scsi 1:0:0:3: Direct-Access Generic USB MS Reader 1.03 PQ: 0 ANSI: 0
    [163903.043570] scsi 1:0:0:3: Attached scsi generic sg4 type 0
    [163903.097573] sd 1:0:0:1: [sdc] Attached SCSI removable disk
    [163903.100928] sd 1:0:0:0: [sdb] Attached SCSI removable disk
    [163903.108183] sd 1:0:0:3: [sde] Attached SCSI removable disk
    [163903.109878] sd 1:0:0:2: [sdd] Attached SCSI removable disk


    from mount:
    ...
    dev/sda2 on /mnt/sda2 type ext4 (rw,relatime)
    tmpfs on /run/user/0 type tmpfs (rw,nosuid,nodev,relatime,size=806492k,mode=700)

    from df:
    ...
    tmpfs 806492 0 806492 0% /run/user/1000
    /dev/sda2 3844510712 90144 3649059904 1% /mnt/sda2

    In case you have a power problem, everything here on both Pi4s runs via a Sitecom USB hub,
    it is even powering an older Raspi1 via some USB output (no you cannot connect via that).
    no extra mains adaptor needed!
    I like the thing.

    But this is running my modified old PI4 image on the new 8GB Pi4B,
    no idea if the recent raspios does the same.
    In My View Linux should have stayed with OSS audio, I had multi channel audio working
    20 year ago on that, alsa broke everything and is counter Unix,
    now raspi changed audio again and the apt-upgrade f*cked up audio,
    on my old Pi4 image (I know, they call that 'improvement') so ffplay audio
    for example I needed a fix like this to play with ffplay via the audio jack:
    raspi99: ~ # cat /usr/local/sbin/ffplay2
    #!/bin/bash
    SDL_AUDIODRIVER='alsa' AUDIODEV='hw:1,0' ffplay $1

    so to play via the audio jack I use 'ffplay2 filename'

    Lots of work to get every script and thing going again.

    But I am glad with the Sitecom USB3 hub, have 2 now, one for each Pi4.
    Same for the Toshiba 3.4 TB USB3 harddisks connected to it,
    other one running 24/7 now for a year or so.

    hdparm shows amazing speed on those
    raspi99: ~ # hdparm -t /dev/sda2
    /dev/sda2:
    Timing buffered disk reads: 408 MB in 3.00 seconds = 135.86 MB/sec

    raspi99: ~ # hdparm -T /dev/sda2
    /dev/sda2:
    Timing cached reads: 1498 MB in 2.00 seconds = 749.07 MB/sec

    not bad!

    --- SoupGate-Win32 v1.05
    * Origin: Agency HUB, Dunedin - New Zealand | Fido<>Usenet Gateway (3:770/3)
  • From Dave Liquorice@3:770/3 to Martin Gregorie on Sat Jan 2 09:49:46 2021
    On Sat, 2 Jan 2021 00:52:59 -0000 (UTC), Martin Gregorie wrote:

    I tend to keep a Pi power cable modified so I can measure the voltage
    across it. I run the cable through a small plastic box with terminals on
    the lid,

    Or get one of the in line USB voltage and current meters. There are
    loads out there of no doubt variable quality. I've a KEX KCX-017 does
    the job (up to 3.5 A) and is accurate enough. Display shows V (to 10
    mV resolution), A (1 mA resolution) and mAHr up to 20 AHr (less 1
    mAHr).

    --
    Cheers
    Dave.

    --- SoupGate-Win32 v1.05
    * Origin: Agency HUB, Dunedin - New Zealand | Fido<>Usenet Gateway (3:770/3)
  • From Martin Gregorie@3:770/3 to Dave Liquorice on Sat Jan 2 12:34:29 2021
    On Sat, 02 Jan 2021 09:49:46 +0000, Dave Liquorice wrote:

    On Sat, 2 Jan 2021 00:52:59 -0000 (UTC), Martin Gregorie wrote:

    I tend to keep a Pi power cable modified so I can measure the voltage
    across it. I run the cable through a small plastic box with terminals
    on the lid,

    Or get one of the in line USB voltage and current meters.

    That makes sense - I didn't know these are available, but should have
    guessed. The only disadvantage would seem to be that you'll end up with a collection on different adapter cables since almost all of them seem to
    have just USB-C connections.

    I've a KEX KCX-017

    Like so many Chinese things, Amazon currently has that one marked as 'unavailable', don't know when we'll have more.

    Dunno why their manufacturers persist in doing that: in makes them look
    like fly-by-night chancers, but maybe that's exactly what they are.


    --
    --
    Martin | martin at
    Gregorie | gregorie dot org

    --- SoupGate-Win32 v1.05
    * Origin: Agency HUB, Dunedin - New Zealand | Fido<>Usenet Gateway (3:770/3)
  • From druck@3:770/3 to bob prohaska on Sat Jan 2 12:36:00 2021
    On 01/01/2021 20:53, bob prohaska wrote:
    Just tried using a couple of USB card adapters with my 8GB Pi4.
    Both cause immediate loss of USB hard disk access. Unplugging
    the offending adapter does not restore normal operation. Power
    cycling puts matters right without apparent ill effect.

    Do you have your USB hard disk mounted using the device name (/dev/sdaX)
    or a disk UUID (UUID=blahblahblahblah) ?

    That should only make a difference when powering on with the adaptor
    present, not when plugging it in when running, but using UUIDs
    eliminates the issue of the device names ever changing.

    ---druck

    --- SoupGate-Win32 v1.05
    * Origin: Agency HUB, Dunedin - New Zealand | Fido<>Usenet Gateway (3:770/3)
  • From Martin Gregorie@3:770/3 to Martin Gregorie on Sat Jan 2 12:51:35 2021
    On Sat, 02 Jan 2021 12:34:29 +0000, Martin Gregorie wrote:

    On Sat, 02 Jan 2021 09:49:46 +0000, Dave Liquorice wrote:

    On Sat, 2 Jan 2021 00:52:59 -0000 (UTC), Martin Gregorie wrote:

    I tend to keep a Pi power cable modified so I can measure the voltage
    across it. I run the cable through a small plastic box with terminals
    on the lid,

    Or get one of the in line USB voltage and current meters.

    That makes sense - I didn't know these are available, but should have guessed. The only disadvantage would seem to be that you'll end up with
    a collection on different adapter cables since almost all of them seem
    to have just USB-C connections.

    I've a KEX KCX-017

    Like so many Chinese things, Amazon currently has that one marked as 'unavailable', don't know when we'll have more.

    Dunno why their manufacturers persist in doing that: in makes them look
    like fly-by-night chancers, but maybe that's exactly what they are.

    Belated thought: I wonder how many of these nice toys, many of which
    which seem to have just one short production run, are actually final year projects for electronic design graduates at Chinese technical
    universities.


    --
    --
    Martin | martin at
    Gregorie | gregorie dot org

    --- SoupGate-Win32 v1.05
    * Origin: Agency HUB, Dunedin - New Zealand | Fido<>Usenet Gateway (3:770/3)
  • From Dave Liquorice@3:770/3 to Martin Gregorie on Sat Jan 2 13:08:08 2021
    On Sat, 2 Jan 2021 12:34:29 -0000 (UTC), Martin Gregorie wrote:

    Or get one of the in line USB voltage and current meters.

    That makes sense - I didn't know these are available, but should have guessed. The only disadvantage would seem to be that you'll end up with
    a collection on different adapter cables since almost all of them seem
    to have just USB-C connections.

    I've a KEX KCX-017

    Like so many Chinese things, Amazon currently has that one marked as 'unavailable', don't know when we'll have more.

    A very quick look appears that there are plenty eBay. From <£3
    delivered from China/HK in a few weeks or >£6 delivered in around a
    week (probably quicker) from UK sellers.

    That unit is quite old and wouldn't be any good for the higher
    voltage/current that USB-C can support (up to 20 V @ 5 A?). There
    appears to be more recent units that can cope with that though.

    Dunno why their manufacturers persist in doing that: in makes them look
    like fly-by-night chancers, but maybe that's exactly what they are.

    I get the impression that once anything is listed on Amazon it stays
    there forever.

    --
    Cheers
    Dave.

    --- SoupGate-Win32 v1.05
    * Origin: Agency HUB, Dunedin - New Zealand | Fido<>Usenet Gateway (3:770/3)
  • From Jan Panteltje@3:770/3 to Gregorie on Sat Jan 2 13:23:17 2021
    On a sunny day (Sat, 2 Jan 2021 12:51:35 -0000 (UTC)) it happened Martin Gregorie <martin@mydomain.invalid> wrote in <rspq8n$4og$2@dont-email.me>:

    On Sat, 02 Jan 2021 12:34:29 +0000, Martin Gregorie wrote:

    On Sat, 02 Jan 2021 09:49:46 +0000, Dave Liquorice wrote:

    On Sat, 2 Jan 2021 00:52:59 -0000 (UTC), Martin Gregorie wrote:

    I tend to keep a Pi power cable modified so I can measure the voltage
    across it. I run the cable through a small plastic box with terminals
    on the lid,

    Or get one of the in line USB voltage and current meters.

    That makes sense - I didn't know these are available, but should have
    guessed. The only disadvantage would seem to be that you'll end up with
    a collection on different adapter cables since almost all of them seem
    to have just USB-C connections.

    I've a KEX KCX-017

    Like so many Chinese things, Amazon currently has that one marked as
    'unavailable', don't know when we'll have more.

    Dunno why their manufacturers persist in doing that: in makes them look
    like fly-by-night chancers, but maybe that's exactly what they are.

    Belated thought: I wonder how many of these nice toys, many of which
    which seem to have just one short production run, are actually final year >projects for electronic design graduates at Chinese technical
    universities.

    Most AFAIK (the stuff I bought) are just based on chip manufacturer application notes.
    If you look at the chip number and locate the data sheet with google you likely find a circuit diagram :-)

    To measure DC without breaking any wires I have a Voltcraft VC-330 (google) AC / DC clamp on meter.
    Maybe slice an existing USB cable open, find the +5 V wire, clamp it on, measure it, tape it closed (have not tried it on USB).
    It is a useful universal thing that you can use for anything like for example measuring stuff in your car or whatever, without disconnecting or cutting wires etc.
    I would not buy something specialized for just USB.

    --- SoupGate-Win32 v1.05
    * Origin: Agency HUB, Dunedin - New Zealand | Fido<>Usenet Gateway (3:770/3)
  • From Deloptes@3:770/3 to Jan Panteltje on Sat Jan 2 16:06:45 2021
    Jan Panteltje wrote:

    It is a useful universal thing that you can use for anything like for
    example measuring stuff in your car or whatever, without disconnecting or cutting wires etc. I would not buy something specialized for just USB.

    USB-C and a device using such connector is not like a car electronics (I
    know the topic here is power supply) and besides you can not measure A or
    mAs without breaking the circuit. If I am wrong let me know.
    In case of data flow you need an oscilloscope as suggested by Martin
    Gregorie.

    --- SoupGate-Win32 v1.05
    * Origin: Agency HUB, Dunedin - New Zealand | Fido<>Usenet Gateway (3:770/3)
  • From Martin Gregorie@3:770/3 to Jan Panteltje on Sat Jan 2 14:52:38 2021
    On Sat, 02 Jan 2021 13:23:17 +0000, Jan Panteltje wrote:

    I would not buy something specialized for just USB.

    Same here, but then I have an oscilloscope and at least three pocket-size multimeters, each is part of a different toolkit for the convenience of
    having a grabbit-and-go box for different purposes, e.g. model flying and soaring, and I've already built the aforementioned breakout boxes for USB
    and other connector sets.


    --
    --
    Martin | martin at
    Gregorie | gregorie dot org

    --- SoupGate-Win32 v1.05
    * Origin: Agency HUB, Dunedin - New Zealand | Fido<>Usenet Gateway (3:770/3)
  • From Jan Panteltje@3:770/3 to deloptes@gmail.com on Sat Jan 2 17:18:57 2021
    On a sunny day (Sat, 02 Jan 2021 16:06:45 +0100) it happened Deloptes <deloptes@gmail.com> wrote in <rsq266$8jh$1@dont-email.me>:

    Jan Panteltje wrote:

    It is a useful universal thing that you can use for anything like for
    example measuring stuff in your car or whatever, without disconnecting or
    cutting wires etc. I would not buy something specialized for just USB.

    USB-C and a device using such connector is not like a car electronics (I
    know the topic here is power supply) and besides you can not measure A or
    mAs without breaking the circuit. If I am wrong let me know.

    No, that clamp on meter measures to a few mA,
    without breaking any connections.
    Use the zero button before you measure.



    In case of data flow you need an oscilloscope as suggested by Martin >Gregorie.

    That is an other thing, I have a scope, never used it for USB data flow
    there are plenty of utiities to check that.





    --- SoupGate-Win32 v1.05
    * Origin: Agency HUB, Dunedin - New Zealand | Fido<>Usenet Gateway (3:770/3)
  • From The Natural Philosopher@3:770/3 to A. Dumas on Sat Jan 2 16:38:17 2021
    On 02/01/2021 16:36, A. Dumas wrote:
    Deloptes <deloptes@gmail.com> wrote:
    you can not measure A or
    mAs without breaking the circuit. If I am wrong let me know.

    Hall-effect ring. (But how would you get the wire through the loop without disconnecting it..? Ok you got me.)

    clamp on meters

    --
    If you tell a lie big enough and keep repeating it, people will
    eventually come to believe it. The lie can be maintained only for such
    time as the State can shield the people from the political, economic
    and/or military consequences of the lie. It thus becomes vitally
    important for the State to use all of its powers to repress dissent, for
    the truth is the mortal enemy of the lie, and thus by extension, the
    truth is the greatest enemy of the State.

    Joseph Goebbels

    --- SoupGate-Win32 v1.05
    * Origin: Agency HUB, Dunedin - New Zealand | Fido<>Usenet Gateway (3:770/3)
  • From A. Dumas@3:770/3 to Deloptes on Sat Jan 2 16:36:44 2021
    Deloptes <deloptes@gmail.com> wrote:
    you can not measure A or
    mAs without breaking the circuit. If I am wrong let me know.

    Hall-effect ring. (But how would you get the wire through the loop without disconnecting it..? Ok you got me.)

    --- SoupGate-Win32 v1.05
    * Origin: Agency HUB, Dunedin - New Zealand | Fido<>Usenet Gateway (3:770/3)
  • From Jan Panteltje@3:770/3 to Gregorie on Sat Jan 2 17:27:41 2021
    On a sunny day (Sat, 2 Jan 2021 14:52:38 -0000 (UTC)) it happened Martin Gregorie <martin@mydomain.invalid> wrote in <rsq1bm$4og$3@dont-email.me>:

    On Sat, 02 Jan 2021 13:23:17 +0000, Jan Panteltje wrote:

    I would not buy something specialized for just USB.

    Same here, but then I have an oscilloscope and at least three pocket-size >multimeters, each is part of a different toolkit for the convenience of >having a grabbit-and-go box for different purposes, e.g. model flying and >soaring, and I've already built the aforementioned breakout boxes for USB
    and other connector sets.

    Yes, Ok.
    I have a like a complete lab with all sort of electronics,
    never seen the need to measure an USB cable,
    a dead short you can test with a multi-meter.
    Model flying I did too, from 31 Dec last year in the EU you need a drone license...
    http://panteltje.com/panteltje/quadcopter/index.html
    have not got the license yet, so my fireworks (also forbidden now) was playing with a blue power laser 2 days ago.
    I have the movie, but better not show it, shine in the clouds ;-)
    World has gone paranoia, if it continuous that way than the next generation will grow up as a bunch of dummies.

    --- SoupGate-Win32 v1.05
    * Origin: Agency HUB, Dunedin - New Zealand | Fido<>Usenet Gateway (3:770/3)
  • From Jan Panteltje@3:770/3 to alexandre@dumas.fr.invalid on Sat Jan 2 17:29:03 2021
    On a sunny day (02 Jan 2021 16:36:44 GMT) it happened A. Dumas <alexandre@dumas.fr.invalid> wrote in
    <5ff0a11c$0$299$e4fe514c@news.xs4all.nl>:

    Deloptes <deloptes@gmail.com> wrote:
    you can not measure A or
    mAs without breaking the circuit. If I am wrong let me know.

    Hall-effect ring. (But how would you get the wire through the loop without >disconnecting it..? Ok you got me.)

    It is 2 halves that can open FYI ;-)

    --- SoupGate-Win32 v1.05
    * Origin: Agency HUB, Dunedin - New Zealand | Fido<>Usenet Gateway (3:770/3)
  • From Martin Gregorie@3:770/3 to Jan Panteltje on Sat Jan 2 18:05:23 2021
    On Sat, 02 Jan 2021 17:27:41 +0000, Jan Panteltje wrote:

    Model flying I did too, from 31 Dec last year in the EU you need a drone license...

    Depends what you fly - I flew single channel RC for a year or to, then discovered free flight competition models, sold the RC gear and never
    looked back.

    No license is needed for free flight if the model weighs less than 250g.

    Also lots more exercise than just standing there holding a Tx, especially
    if you fly F1A (tow-line launched gliders - the faster you run before
    launch the higher it gets after release).

    http://panteltje.com/panteltje/quadcopter/index.html
    have not got the license yet, so my fireworks (also forbidden now) was playing with a blue power laser 2 days ago.

    I'd ban those (spoken with my pilot hat on) due to all the brain-dead
    idiots who think shining them at aircraft is cool.

    Oddly enough, the main use my scope got was checking the battery
    condition for my Koster dethermaliser timers: These ran off a stack of
    four 50mAh NiCds and were used to bring the model down out of a thermal
    at the end a timed competition flight. They do this by putting 500mA
    through a solenoid for 10 mS - this releases a catch on the tailplane
    which puts the glider into a stable deep stall, turning it into a rigid parachute so it drops out of the thermal and usually lands without damage.

    Looking at the shape of the solenoid pulse was a great way of checking
    battery condition. A good, new battery showed a nice bathtub curve- 1.5v
    deep with an 8ms flat bottom and a 45 degree recovery slope. As the
    battery aged, the flat bottom got shorter and the voltage drop increased, eventually becoming a 4v deep triangle. I replaced batteries once the
    voltage drop exceeded 2.5v - the time I put into designing, building and adjusting a new model vastly exceeded the cost of a new set of batteries.


    --
    --
    Martin | martin at
    Gregorie | gregorie dot org

    --- SoupGate-Win32 v1.05
    * Origin: Agency HUB, Dunedin - New Zealand | Fido<>Usenet Gateway (3:770/3)
  • From Jan Panteltje@3:770/3 to Gregorie on Sat Jan 2 19:45:37 2021
    On a sunny day (Sat, 2 Jan 2021 18:05:23 -0000 (UTC)) it happened Martin Gregorie <martin@mydomain.invalid> wrote in <rsqcl3$at5$1@dont-email.me>:

    On Sat, 02 Jan 2021 17:27:41 +0000, Jan Panteltje wrote:

    Model flying I did too, from 31 Dec last year in the EU you need a drone
    license...

    Depends what you fly - I flew single channel RC for a year or to, then >discovered free flight competition models, sold the RC gear and never
    looked back.

    No license is needed for free flight if the model weighs less than 250g.

    I think it is: "Unless it has a camera" (most of those do however).

    Also lots more exercise than just standing there holding a Tx, especially
    if you fly F1A (tow-line launched gliders - the faster you run before
    launch the higher it gets after release).

    LOL, well I bike a lot...

    For me it is all curiosity, seemed interesting to write an auto-pilot
    and that works very well.
    It can be used for anything from rescue to warfare (drop a bomb).


    http://panteltje.com/panteltje/quadcopter/index.html
    have not got the license yet, so my fireworks (also forbidden now) was
    playing with a blue power laser 2 days ago.

    I'd ban those (spoken with my pilot hat on) due to all the brain-dead
    idiots who think shining them at aircraft is cool.

    This is the problem, there is ALWAYS someone who does bad things with things, did you know you can kill somebody with a fork?
    So now we forbid all forks (after the knives that is), same for
    so many other things.
    It is the wrong way to go about it all.
    Also it is money sucking.
    I got my radio ham license when it was free, after that now I have to pay like 30 Euro a year,,,
    The drone license is not free, and in a few years your drone needs an ID transmitter on the drone AND one on the remote,
    so they can find where it is and the whereabout of who controls it.
    If Russia did it it would be called ....?
    Total control state, revolution is needed, I have the tech, much more than this.
    You see people rising up against the total lockdown, big party thing in France I just did read, 2500 people together
    in some hall, they chased the police out!


    Oddly enough, the main use my scope got was checking the battery
    condition for my Koster dethermaliser timers: These ran off a stack of
    four 50mAh NiCds and were used to bring the model down out of a thermal
    at the end a timed competition flight. They do this by putting 500mA
    through a solenoid for 10 mS - this releases a catch on the tailplane
    which puts the glider into a stable deep stall, turning it into a rigid >parachute so it drops out of the thermal and usually lands without damage.

    Nice system, nicads (I still have one that works) are a bit from the past these days,
    lipos work great for my drone, I tried liion (with power converter) but that does not fly longer.
    Then I tried a wire, and sure you can keep the thing in the air indefinitely:
    http://panteltje.com/pub/h501s_drone_remote_power_flight_test_1_IMG_6274.JPG
    note the thin coax over the fence, I send several hundred volt at 100 kHz, transformed it down at the drone,
    the high volts at low current allows for a thin light coax.

    Position of the drone using differential GPS is within a few cm stable.

    http://panteltje.com/pub/h501s_drone_remote_power_test_ground_control_1_IMG_627 6.JPG
    with scope :-)

    The drone side, the high voltage is transformed down by a ringcore transformer to 7.5 V 10A
    the high current rectifier diodes are on heatsinks in the air flow from the propellers:
    http://panteltje.com/pub/h501s_drone_remote_power_drone_side_IMG_6278.JPG

    Part of the 'lab':
    http://panteltje.com/pub/h501s_drone_remote_power_lab_test_IMG_6271.JPG


    Looking at the shape of the solenoid pulse was a great way of checking >battery condition. A good, new battery showed a nice bathtub curve- 1.5v
    deep with an 8ms flat bottom and a 45 degree recovery slope. As the
    battery aged, the flat bottom got shorter and the voltage drop increased, >eventually becoming a 4v deep triangle. I replaced batteries once the
    voltage drop exceeded 2.5v - the time I put into designing, building and >adjusting a new model vastly exceeded the cost of a new set of batteries.

    Designing 'tronics and playing with 'tricety I started at 4 years old,
    became my job at some point.
    It is fun.

    --- SoupGate-Win32 v1.05
    * Origin: Agency HUB, Dunedin - New Zealand | Fido<>Usenet Gateway (3:770/3)
  • From Martin Gregorie@3:770/3 to Jan Panteltje on Sat Jan 2 20:41:05 2021
    On Sat, 02 Jan 2021 19:45:37 +0000, Jan Panteltje wrote:

    On a sunny day (Sat, 2 Jan 2021 18:05:23 -0000 (UTC)) it happened Martin
    No license is needed for free flight if the model weighs less than 250g.

    I think it is: "Unless it has a camera" (most of those do however).

    Nope. I've never even heard of cameras on Free flight. They're just
    irrelevant because by definition the only control possible on a free
    flight model is an RDT: the whole point is that the model can't be
    controlled after launch because what a contest is about is the art of
    launching into lift and of designing/building trimming the model so it ca self-centre in the lift patch it was launched into. Scoring is simple: at
    the end of a competition the winner is the person with the highest total
    flight time.

    RDT = radio dethermaliser - pushing the button is an irreversable action
    that overrides the onboard timer forcing it to end the flight.

    We do carry reverse links though (radio trackers to aid retrieval after a flight and some carry a GPS which modulates the tracker to send location information back to the model's flyer. Like the tracker, this just makes retrieval easier after the flight.

    Seems like you might never have seen a free flight model. Look here: https://www.gregorie.org/freeflight/index.html

    and there'a bit on the Koster timer here: https://www.gregorie.org/freeflight/timers/personal.html


    --
    --
    Martin | martin at
    Gregorie | gregorie dot org

    --- SoupGate-Win32 v1.05
    * Origin: Agency HUB, Dunedin - New Zealand | Fido<>Usenet Gateway (3:770/3)
  • From bob prohaska@3:770/3 to druck on Sat Jan 2 20:45:06 2021
    druck <news@druck.org.uk> wrote:
    On 01/01/2021 20:53, bob prohaska wrote:
    Just tried using a couple of USB card adapters with my 8GB Pi4.
    Both cause immediate loss of USB hard disk access. Unplugging
    the offending adapter does not restore normal operation. Power
    cycling puts matters right without apparent ill effect.

    Do you have your USB hard disk mounted using the device name (/dev/sdaX)
    or a disk UUID (UUID=blahblahblahblah) ?

    It's the default setup, using UUID. The machine was already running,
    so that shouldn't matter. Plugging in the adapter seemed to cause
    a persistent USB error, it was the persistence that seemed most odd.
    There's no powered hub involved, on the thesis that a 3.5 amp power
    supply and a USB 3.0 port should be ok on their own. Indeed, the
    machine boots hands-off from the mechanical hard disk.

    I did do a power supply check. It's not quite as good as expected,
    5.08 volts booted and idle, 5.00 to 5.03 volts between GPIO pins
    2 and 39 while running the "SD card speed test" which appears to
    be a "boot device speed test" instead. That seems good enough to
    support a USB-microSD adapter being plugged in. Of course, a DVM
    is blind to transients, so it's of limited use.

    I'll wait until I don't mind crashing the machine and try again
    using the USB 2.0 ports.

    Thanks for writing,

    bob prohaska



    ---druck

    --- SoupGate-Win32 v1.05
    * Origin: Agency HUB, Dunedin - New Zealand | Fido<>Usenet Gateway (3:770/3)
  • From David Higton@3:770/3 to Jan Panteltje on Sat Jan 2 20:21:46 2021
    In message <rsq9vr$nr8$1@gioia.aioe.org>
    Jan Panteltje <pNaOnStPeAlMtje@yahoo.com> wrote:

    That is an other thing, I have a scope, never used it for USB data flow

    I bought a Picoscope about a year ago. It decodes various serial
    data streams on screen. I used it to decode OpenTherm (Manchester
    code).

    David

    --- SoupGate-Win32 v1.05
    * Origin: Agency HUB, Dunedin - New Zealand | Fido<>Usenet Gateway (3:770/3)
  • From Jan Panteltje@3:770/3 to Gregorie on Sun Jan 3 05:53:41 2021
    On a sunny day (Sat, 2 Jan 2021 20:41:05 -0000 (UTC)) it happened Martin Gregorie <martin@mydomain.invalid> wrote in <rsqlp0$at5$2@dont-email.me>:

    On Sat, 02 Jan 2021 19:45:37 +0000, Jan Panteltje wrote:

    On a sunny day (Sat, 2 Jan 2021 18:05:23 -0000 (UTC)) it happened Martin >>>No license is needed for free flight if the model weighs less than 250g.

    I think it is: "Unless it has a camera" (most of those do however).

    Nope. I've never even heard of cameras on Free flight. They're just >irrelevant because by definition the only control possible on a free
    flight model is an RDT: the whole point is that the model can't be
    controlled after launch because what a contest is about is the art of >launching into lift and of designing/building trimming the model so it ca >self-centre in the lift patch it was launched into. Scoring is simple: at
    the end of a competition the winner is the person with the highest total >flight time.

    I have no experience with 'free flight' other than folding paper airplanes.... Cameras weight next to nothing and can record automatically to some microSDcard...
    would be nice to get an aerial view?


    RDT = radio dethermaliser - pushing the button is an irreversable action
    that overrides the onboard timer forcing it to end the flight.

    We do carry reverse links though (radio trackers to aid retrieval after a >flight and some carry a GPS which modulates the tracker to send location >information back to the model's flyer. Like the tracker, this just makes >retrieval easier after the flight.

    Yes,


    Seems like you might never have seen a free flight model. Look here: >https://www.gregorie.org/freeflight/index.html

    Nice, but being an electronics freak so to speak I want power and control.

    But free flight models seem a great way to learn about aerodynamics.
    Not much of a competition person here, just experimenting. make my own rules set my own targets.


    and there'a bit on the Koster timer here: >https://www.gregorie.org/freeflight/timers/personal.html


    Nice, for those days electronics, used the 555 myself in industry...

    These days I just program a Microchip PIC controller in asm, set values via serial link before takeoff,
    like for the air text:
    http://panteltje.com/panteltje/quadcopter/hsign.html

    HUD display with on screen GPS and power:
    http://panteltje.com/panteltje/quadcopter/hud.html

    Auto pilot controlling drone and dropping load:
    https://www.youtube.com/watch?v=bI_0mjwlvNw

    I do not use a solenoid, but an electric motor with a screw that releases some nuts, this gives more power with heavy loads,
    at low peak current.

    http://panteltje.com/panteltje/quadcopter/H501S_load_releasy_system_mounting_IM G_6049.JPG
    also note the micro-sdcard for the video...

    Precise hands free flight to a few cm.
    Better get the GPS stuff right, the first experiments needed fast user interaction to prevent it
    flying through windows etc...
    The 'tronics' is basically very simple.
    Programming in asm on PIC micros is fun :-) It (the hardware) does what you tell it to do,

    China has demonstrated large groups of drones flying art like formations using something like this tech:
    https://www.youtube.com/watch?v=VnTQTm7vNbY

    --- SoupGate-Win32 v1.05
    * Origin: Agency HUB, Dunedin - New Zealand | Fido<>Usenet Gateway (3:770/3)
  • From Theo@3:770/3 to Martin Gregorie on Sun Jan 3 10:07:47 2021
    Martin Gregorie <martin@mydomain.invalid> wrote:
    Belated thought: I wonder how many of these nice toys, many of which
    which seem to have just one short production run, are actually final year projects for electronic design graduates at Chinese technical
    universities.

    Seems unlikely. There's a whole 'shanzhai' ecosystem of product development
    in Shenzhen, churning out rapid iterations of products all riffing
    off/stealing from each other:

    https://www.wired.co.uk/article/shanzai https://www.theatlantic.com/technology/archive/2014/05/chinas-mass-production-s ystem/370898/

    (separately, the fact that this listing is out of stock is just an Amazon artifact. You can likely find the same product elsewhere under a different brand. Amazon encourages sellers to have multiple bogus brands, but you'll probably find it unbranded on ebay and Aliexpress too)

    Theo

    --- SoupGate-Win32 v1.05
    * Origin: Agency HUB, Dunedin - New Zealand | Fido<>Usenet Gateway (3:770/3)
  • From Martin Gregorie@3:770/3 to All on Sun Jan 3 14:39:08 2021

    Nice, but being an electronics freak so to speak I want power and
    control.

    Understood, but as far as models are concerned, I preferred flying
    control-line models to RC. For controlled flight I just climb into my
    Standard Libelle and take a winch launch: just 35 seconds from first
    movement to 450m and cruises at 120 kph.

    But free flight models seem a great way to learn about aerodynamics.
    Not much of a competition person here, just experimenting. make my own
    rules set my own targets.

    Yes, that's very true. But, a big benefit of competition flying is that
    it gets you out of the house on less than perfect days: no matter how
    good or bad, the weather is the same for everybody in the contest.

    I do not use a solenoid, but an electric motor with a screw that
    releases some nuts, this gives more power with heavy loads,
    at low peak current.

    Yes, that makes sense.

    Programming in asm on PIC micros is fun :-) It (the hardware) does what
    you tell it to do,

    I've got a PICAXE to experiment with, which I quite like apart from its
    rather unpleasant unsigned integer BASIC, but I csan live with that. I do
    like the built-in device controllers though, especially the servo drivers
    - perfect for controlling small BEC-equipped motors and EDF (electric
    ducted fan) systems.



    --
    --
    Martin | martin at
    Gregorie | gregorie dot org

    --- SoupGate-Win32 v1.05
    * Origin: Agency HUB, Dunedin - New Zealand | Fido<>Usenet Gateway (3:770/3)
  • From Jan Panteltje@3:770/3 to Gregorie on Sun Jan 3 15:41:04 2021
    On a sunny day (Sun, 3 Jan 2021 14:39:08 -0000 (UTC)) it happened Martin Gregorie <martin@mydomain.invalid> wrote in <rsskuc$pim$1@dont-email.me>:

    Understood, but as far as models are concerned, I preferred flying >control-line models to RC. For controlled flight I just climb into my >Standard Libelle and take a winch launch: just 35 seconds from first
    movement to 450m and cruises at 120 kph.

    Yea I better not go into detail here of my adventures in the F100 Super Sabre..
    when I got the order to abort, so many lives at stake...
    ;-)



    But free flight models seem a great way to learn about aerodynamics.
    Not much of a competition person here, just experimenting. make my own
    rules set my own targets.

    Yes, that's very true. But, a big benefit of competition flying is that
    it gets you out of the house on less than perfect days: no matter how
    good or bad, the weather is the same for everybody in the contest.


    Yes, one problem here is that the government decreed the whole area to a no fly zone
    for model aircraft.. I am close to Leeuwarden mil airbase.
    One reason I do not fly this one:
    http://panteltje.com/pub/axion_laser_arrow_IXIMG_0650.JPG
    serves more as ornament, wrote a whole lot of stuff for that though.
    But it needs space, 160 km/h.


    Programming in asm on PIC micros is fun :-) It (the hardware) does what
    you tell it to do,

    I've got a PICAXE to experiment with, which I quite like apart from its >rather unpleasant unsigned integer BASIC, but I csan live with that. I do >like the built-in device controllers though, especially the servo drivers
    - perfect for controlling small BEC-equipped motors and EDF (electric
    ducted fan) systems.

    I also wrote the software I use to program the PICs, the hardware is based on the noppp programmer,
    just modified it a bit for the modern PICs:
    http://panteltje.com/panteltje/pic/jppp18/index.html
    uses PC parport, using a PCI card with parport connector in the modern PC..


    did many PIC projects, some are on my site:
    http://panteltje.com/panteltje/pic/index.html

    As to that BASIC: in my view asm is often simpler, indeed the PIC hardware is nice.
    I use an asm math library written by someone else, so far 32 bit integer was all I needed,
    In asm you do not have to worry about code generation by whatever... compiler ...

    Also the PICs give you near zero boot time, near zero power consumption, near zero weight, near zero cost (about 2$ a piece).

    --- SoupGate-Win32 v1.05
    * Origin: Agency HUB, Dunedin - New Zealand | Fido<>Usenet Gateway (3:770/3)
  • From Joe@3:770/3 to Jan Panteltje on Sun Jan 3 18:38:44 2021
    On Sun, 03 Jan 2021 15:41:04 GMT
    Jan Panteltje <pNaOnStPeAlMtje@yahoo.com> wrote:



    I use an asm math library written by someone else,
    so far 32 bit integer was all I needed,

    "If you need to use floating-point arithmetic in FORTH, you do not
    fully understand your application"

    Not sure if it was Charles Moore or Leo Brodie who said that.

    --
    Joe

    --- SoupGate-Win32 v1.05
    * Origin: Agency HUB, Dunedin - New Zealand | Fido<>Usenet Gateway (3:770/3)
  • From Theo@3:770/3 to Theo on Sun Jan 3 18:39:03 2021
    Theo <theom+news@chiark.greenend.org.uk> wrote:
    (separately, the fact that this listing is out of stock is just an Amazon artifact. You can likely find the same product elsewhere under a different brand. Amazon encourages sellers to have multiple bogus brands, but you'll probably find it unbranded on ebay and Aliexpress too)

    Dozens of them: https://www.aliexpress.com/wholesale?catId=0&origin=y&SearchText=KCX-017

    Theo

    --- SoupGate-Win32 v1.05
    * Origin: Agency HUB, Dunedin - New Zealand | Fido<>Usenet Gateway (3:770/3)
  • From Charlie Gibbs@3:770/3 to Joe on Sun Jan 3 19:15:59 2021
    On 2021-01-03, Joe <joe@jretrading.com> wrote:

    On Sun, 03 Jan 2021 15:41:04 GMT
    Jan Panteltje <pNaOnStPeAlMtje@yahoo.com> wrote:

    I use an asm math library written by someone else,
    so far 32 bit integer was all I needed,

    "If you need to use floating-point arithmetic in FORTH,
    you do not fully understand your application"

    Not sure if it was Charles Moore or Leo Brodie who said that.

    It makes sense, though, depending on your applications.
    In 50 years of commercial programming, I can count the
    number of times I've used floating point on the fingers
    of one hand.

    --
    /~\ Charlie Gibbs | "Some of you may die,
    \ / <cgibbs@kltpzyxm.invalid> | but it's a sacrifice
    X I'm really at ac.dekanfrus | I'm willing to make."
    / \ if you read it the right way. | -- Lord Farquaad (Shrek)

    --- SoupGate-Win32 v1.05
    * Origin: Agency HUB, Dunedin - New Zealand | Fido<>Usenet Gateway (3:770/3)
  • From Martin Gregorie@3:770/3 to Joe on Sun Jan 3 19:36:54 2021
    On Sun, 03 Jan 2021 18:38:44 +0000, Joe wrote:


    "If you need to use floating-point arithmetic in FORTH, you do not
    fully understand your application"

    Not sure if it was Charles Moore or Leo Brodie who said that.

    PICAXE BASIC is a little more limited than that: variables may be 8 or 16
    bit and they are all UNSIGNED, which, I would suggest is a bit more
    limiting than doing without floating point. This is the only computer
    language I've used that doesn't support signed integer values.

    A fairly rapid web search failed to discover whether unsigned arithmetic
    is a feature of the BASIC or if the PIC micro-controller only works with unsigned values. I found several low level architecture descriptions,
    which all mention stuff like data storage and register lengths, but since
    none of them mentioned signed arithmetic, it seems that it isn't
    supported.


    --
    --
    Martin | martin at
    Gregorie | gregorie dot org

    --- SoupGate-Win32 v1.05
    * Origin: Agency HUB, Dunedin - New Zealand | Fido<>Usenet Gateway (3:770/3)
  • From Joe@3:770/3 to Martin Gregorie on Sun Jan 3 21:16:36 2021
    On Sun, 3 Jan 2021 19:36:54 -0000 (UTC)
    Martin Gregorie <martin@mydomain.invalid> wrote:

    On Sun, 03 Jan 2021 18:38:44 +0000, Joe wrote:


    "If you need to use floating-point arithmetic in FORTH, you do not
    fully understand your application"

    Not sure if it was Charles Moore or Leo Brodie who said that.

    PICAXE BASIC is a little more limited than that: variables may be 8
    or 16 bit and they are all UNSIGNED, which, I would suggest is a bit
    more limiting than doing without floating point. This is the only
    computer language I've used that doesn't support signed integer
    values.

    A fairly rapid web search failed to discover whether unsigned
    arithmetic is a feature of the BASIC

    There is no feature list of BASIC. There are standard BASICs from
    Dartmouth, there was Applesoft on the Apple II (integer only), and most
    BBC BASICs were only distinguishable from PASCAL by having built-in
    assemblers (yes, including BBC BASIC V on the ARM-based Archimedes).
    Quite a variation. I hated the old line number thing.

    or if the PIC micro-controller
    only works with unsigned values. I found several low level
    architecture descriptions, which all mention stuff like data storage
    and register lengths, but since none of them mentioned signed
    arithmetic, it seems that it isn't supported.


    No. All the arithmetic operators are signed, at least in the less
    primitive PICs. They only work with the PIC data word length, but can be
    easily cascaded for more bits using the accumulator status bits. Look at
    the instruction set in any PIC datasheet.

    I've only ever used assembler, as I've wanted complete control over
    timings, and I don't think I've ever needed more than 16 bits. I've
    done mostly TV camera remote control software and a Canon lens
    controller. There are C compilers for the PICs, but I wanted to write
    my own interrupt routines, as the SPI used on the Canon AF can be
    pretty fast, and the Canon SPI variation meant some real-time bit
    banging was required.

    --
    Joe

    --- SoupGate-Win32 v1.05
    * Origin: Agency HUB, Dunedin - New Zealand | Fido<>Usenet Gateway (3:770/3)
  • From Martin Gregorie@3:770/3 to Joe on Sun Jan 3 22:40:33 2021
    On Sun, 03 Jan 2021 21:16:36 +0000, Joe wrote:

    On Sun, 3 Jan 2021 19:36:54 -0000 (UTC)
    Martin Gregorie <martin@mydomain.invalid> wrote:

    A fairly rapid web search failed to discover whether unsigned
    arithmetic is a feature of the BASIC

    There is no feature list of BASIC.

    I know that all so-called BASICs differ, some radically from the original Dartmouth BASIC. I thought that the context would make it plain that I
    was talking about PICAXE BASIC, which differs enough from traditional
    BASICs to be given another name (labels not numbers for branch
    destinations and subroutines, long names for variables, named constants, unsigned arithmetic and comparisons, conditional statement inclusion).

    No. All the arithmetic operators are signed,

    Not according to the current PICAXE BASIC manual, which gives numeric
    ranges for 8 and 16 bit variables capable of containing byte values in
    the range 0-255 and explicitly says that byte values are unsigned. It alao
    says that 16 bit variable can hold 0-65535, which implies, though it
    doesn't state, that these are unsigned.

    See https://picaxe.com/docs/picaxe_manual2.pdf

    If this is a mistake, they get a down vote for not correcting their
    manual, despite having three years to have made the correction - I bought
    the PICAXE and downloaded to manual 2.5 years ago and then got distracted
    from that project, but the online manual's wording (section 2, page 13)
    remains the same - I just checked.

    BTW I'm using the PICAXE-14M because I need at least 3 PWM outputs. and,
    to put this on topic for the RPi group, am running the BASIC compiler/
    uploader on a headless Pi 2B. This setup successfully uploads compiled
    code to the PICAXE and displays messages from it on the RPi's
    console.


    --
    --
    Martin | martin at
    Gregorie | gregorie dot org

    --- SoupGate-Win32 v1.05
    * Origin: Agency HUB, Dunedin - New Zealand | Fido<>Usenet Gateway (3:770/3)
  • From Dennis Lee Bieber@3:770/3 to All on Sun Jan 3 20:44:03 2021
    On Sun, 3 Jan 2021 22:40:33 -0000 (UTC), Martin Gregorie <martin@mydomain.invalid> declaimed the following:

    I know that all so-called BASICs differ, some radically from the original >Dartmouth BASIC. I thought that the context would make it plain that I
    was talking about PICAXE BASIC, which differs enough from traditional
    BASICs to be given another name (labels not numbers for branch
    destinations and subroutines, long names for variables, named constants, >unsigned arithmetic and comparisons, conditional statement inclusion).


    PICAXE BASIC and BASIC-Stamp BASICs were optimized for microcontrollers with GPIO. Unsigned arithmetic maps to an 8-bit GPIO control register quite well (especially for bit masking). The processor chips have most of their
    flash memory filled with a simplified BASIC byte-code interpreter -- one's application gets downloaded (as byte-code) to a small EEPROM (or worse -- a large RAM) and is treated as data by the interpreter.

    A BS2 has only 32-bytes of RAM, and 6 of those are dedicated to GPIO input, output, and direction control. That leaves just 13 16-bit variables
    or 26 8-bit variables. The BS2 does allow defining variables and bit,
    nybble, byte, or word -- and the compiler does its best to optimize the RAM allocation. The manual does imply that the BS2 supports signed 16-bit
    values -- but when outputting them (debug print) one needs to specify the
    SDEC formatter, otherwise one gets an unsigned representation.


    --
    Wulfraed Dennis Lee Bieber AF6VN
    wlfraed@ix.netcom.com http://wlfraed.microdiversity.freeddns.org/

    --- SoupGate-Win32 v1.05
    * Origin: Agency HUB, Dunedin - New Zealand | Fido<>Usenet Gateway (3:770/3)
  • From The Natural Philosopher@3:770/3 to Charlie Gibbs on Mon Jan 4 03:17:27 2021
    On 03/01/2021 19:15, Charlie Gibbs wrote:
    On 2021-01-03, Joe <joe@jretrading.com> wrote:

    On Sun, 03 Jan 2021 15:41:04 GMT
    Jan Panteltje <pNaOnStPeAlMtje@yahoo.com> wrote:

    I use an asm math library written by someone else,
    so far 32 bit integer was all I needed,

    "If you need to use floating-point arithmetic in FORTH,
    you do not fully understand your application"

    Not sure if it was Charles Moore or Leo Brodie who said that.

    It makes sense, though, depending on your applications.
    In 50 years of commercial programming, I can count the
    number of times I've used floating point on the fingers
    of one hand.

    Odd. I use it extensively. Not for money oriented stuff tho




    --
    New Socialism consists essentially in being seen to have your heart in
    the right place whilst your head is in the clouds and your hand is in
    someone else's pocket.

    --- SoupGate-Win32 v1.05
    * Origin: Agency HUB, Dunedin - New Zealand | Fido<>Usenet Gateway (3:770/3)
  • From Joe@3:770/3 to Martin Gregorie on Mon Jan 4 09:38:19 2021
    On Sun, 3 Jan 2021 22:40:33 -0000 (UTC)
    Martin Gregorie <martin@mydomain.invalid> wrote:

    On Sun, 03 Jan 2021 21:16:36 +0000, Joe wrote:

    On Sun, 3 Jan 2021 19:36:54 -0000 (UTC)
    Martin Gregorie <martin@mydomain.invalid> wrote:

    A fairly rapid web search failed to discover whether unsigned
    arithmetic is a feature of the BASIC

    There is no feature list of BASIC.

    I know that all so-called BASICs differ, some radically from the
    original Dartmouth BASIC. I thought that the context would make it
    plain that I was talking about PICAXE BASIC, which differs enough
    from traditional BASICs to be given another name (labels not numbers
    for branch destinations and subroutines, long names for variables,
    named constants, unsigned arithmetic and comparisons, conditional
    statement inclusion).

    No. All the arithmetic operators are signed,

    Not according to the current PICAXE BASIC manual, which gives numeric
    ranges for 8 and 16 bit variables capable of containing byte values
    in the range 0-255 and explicitly says that byte values are unsigned.
    It alao says that 16 bit variable can hold 0-65535, which implies,
    though it doesn't state, that these are unsigned.

    Sorry, misunderstanding. I thought you were asking if PICAXE couldn't
    do signed because the underlying PIC processor couldn't handle signed.

    --
    Joe

    --- SoupGate-Win32 v1.05
    * Origin: Agency HUB, Dunedin - New Zealand | Fido<>Usenet Gateway (3:770/3)
  • From Martin Gregorie@3:770/3 to Dennis Lee Bieber on Mon Jan 4 11:46:51 2021
    On Sun, 03 Jan 2021 20:44:03 -0500, Dennis Lee Bieber wrote:

    On Sun, 3 Jan 2021 22:40:33 -0000 (UTC), Martin Gregorie <martin@mydomain.invalid> declaimed the following:

    I know that all so-called BASICs differ, some radically from the
    original Dartmouth BASIC. I thought that the context would make it plain >>that I was talking about PICAXE BASIC, which differs enough from >>traditional BASICs to be given another name (labels not numbers for
    branch destinations and subroutines, long names for variables, named >>constants, unsigned arithmetic and comparisons, conditional statement >>inclusion).


    PICAXE BASIC and BASIC-Stamp BASICs were optimized for
    microcontrollers
    with GPIO. Unsigned arithmetic maps to an 8-bit GPIO control register
    quite well (especially for bit masking). The processor chips have most
    of their flash memory filled with a simplified BASIC byte-code
    interpreter -- one's application gets downloaded (as byte-code) to a
    small EEPROM (or worse -- a large RAM) and is treated as data by the interpreter.

    A BS2 has only 32-bytes of RAM, and 6 of those are dedicated to
    GPIO
    input, output, and direction control. That leaves just 13 16-bit
    variables or 26 8-bit variables. The BS2 does allow defining variables
    and bit, nybble, byte, or word -- and the compiler does its best to
    optimize the RAM allocation. The manual does imply that the BS2 supports signed 16-bit values -- but when outputting them (debug print) one needs
    to specify the SDEC formatter, otherwise one gets an unsigned
    representation.

    Agreed - I've done rather more with BS2 STAMPS than I have with PICAXE -
    even had a flight timer for an F1A glider running on a breadboard. This
    read timer settings, which are all positive values, from a control box,
    but didn't need to output them. The logic did use signed values, though,
    to terminate count-down sequences.

    However, I barely got past noddy experiments to get familiarised with
    PICAXE BASIC before putting that project to one side, but its likely to
    be woken up again quite soon.

    So, I'm aware that the BS2 BASIC uses signed integer variables and
    consequently was quite surprised that PICAXE BASIC doesn't.


    --
    --
    Martin | martin at
    Gregorie | gregorie dot org

    --- SoupGate-Win32 v1.05
    * Origin: Agency HUB, Dunedin - New Zealand | Fido<>Usenet Gateway (3:770/3)
  • From Martin Gregorie@3:770/3 to The Natural Philosopher on Mon Jan 4 11:33:43 2021
    On Mon, 04 Jan 2021 03:17:27 +0000, The Natural Philosopher wrote:

    On 03/01/2021 19:15, Charlie Gibbs wrote:
    On 2021-01-03, Joe <joe@jretrading.com> wrote:

    On Sun, 03 Jan 2021 15:41:04 GMT Jan Panteltje
    <pNaOnStPeAlMtje@yahoo.com> wrote:

    I use an asm math library written by someone else,
    so far 32 bit integer was all I needed,

    "If you need to use floating-point arithmetic in FORTH,
    you do not fully understand your application"

    Not sure if it was Charles Moore or Leo Brodie who said that.

    It makes sense, though, depending on your applications.
    In 50 years of commercial programming, I can count the number of times
    I've used floating point on the fingers of one hand.

    Odd. I use it extensively. Not for money oriented stuff tho

    Not that odd: in a 30 year IT career (system design, programming,
    sysadmin, much of it databases and finance-related systems) I can only
    think of one survey analysis program I wrote, in Algol 60, that used
    floating point (and that was for a one-off task).

    Financial systems never use floating point for accuracy reasons:
    consequently integers are used to hold currency amounts: sterling amounts
    are held as pence, euros and dollars as cents and the equivalent
    convention is used for all other currencies. The only exception I'm aware
    of was financial packages written in BASIC for early microcomputers, and
    that was only because (a) integers tended to be 16 bits at most and (b)
    their PRINT statements often couldn't interpolate a decimal point when displaying an integer value.

    OTOH COBOL was designed from the outset to deal with currency amounts
    held as integers:

    77 INVOICE-TOTAL PIC £99,999,990.00CR COMP SYNC BLANK WHEN ZERO.

    might look as if its floating point but, the variable would be a 32 bit
    signed integer which would be read or written as a string containing the currency sign, possibly containing comma separators and with a decimal
    point separating pounds from pence.

    RPG (UGH!) does the same and all modern languages (and assemblers) have sufficiently powerful number scanning and formatting library functions to
    do the same.


    --
    --
    Martin | martin at
    Gregorie | gregorie dot org

    --- SoupGate-Win32 v1.05
    * Origin: Agency HUB, Dunedin - New Zealand | Fido<>Usenet Gateway (3:770/3)
  • From Martin Gregorie@3:770/3 to Joe on Mon Jan 4 12:03:27 2021
    On Mon, 04 Jan 2021 09:38:19 +0000, Joe wrote:

    On Sun, 3 Jan 2021 22:40:33 -0000 (UTC)
    Martin Gregorie <martin@mydomain.invalid> wrote:

    On Sun, 03 Jan 2021 21:16:36 +0000, Joe wrote:

    On Sun, 3 Jan 2021 19:36:54 -0000 (UTC)
    Martin Gregorie <martin@mydomain.invalid> wrote:

    A fairly rapid web search failed to discover whether unsigned
    arithmetic is a feature of the BASIC

    There is no feature list of BASIC.

    I know that all so-called BASICs differ, some radically from the
    original Dartmouth BASIC. I thought that the context would make it
    plain that I was talking about PICAXE BASIC, which differs enough from
    traditional BASICs to be given another name (labels not numbers for
    branch destinations and subroutines, long names for variables, named
    constants, unsigned arithmetic and comparisons, conditional statement
    inclusion).

    No. All the arithmetic operators are signed,

    Not according to the current PICAXE BASIC manual, which gives numeric
    ranges for 8 and 16 bit variables capable of containing byte values in
    the range 0-255 and explicitly says that byte values are unsigned.
    It alao says that 16 bit variable can hold 0-65535, which implies,
    though it doesn't state, that these are unsigned.

    Sorry, misunderstanding. I thought you were asking if PICAXE couldn't do signed because the underlying PIC processor couldn't handle signed.

    No problem. At least this made me look at the PIC architecture and
    discover that it doesn't handle signed integers - I think its the only
    system I've know of at that doesn't, so I didn't realise at first that
    this limitation is in the hardware rather than a feature of the BASIC
    compiler.


    --
    --
    Martin | martin at
    Gregorie | gregorie dot org

    --- SoupGate-Win32 v1.05
    * Origin: Agency HUB, Dunedin - New Zealand | Fido<>Usenet Gateway (3:770/3)
  • From Ahem A Rivet's Shot@3:770/3 to Martin Gregorie on Mon Jan 4 12:24:31 2021
    On Mon, 4 Jan 2021 11:33:43 -0000 (UTC)
    Martin Gregorie <martin@mydomain.invalid> wrote:

    Financial systems never use floating point for accuracy reasons:
    consequently integers are used to hold currency amounts: sterling amounts
    are held as pence, euros and dollars as cents and the equivalent
    convention is used for all other currencies.

    I gather that micro-cents/pence are sometimes used when interest calculations are involved and the fractions matter, I've used milli-pence.

    --
    Steve O'Hara-Smith | Directable Mirror Arrays C:\>WIN | A better way to focus the sun
    The computer obeys and wins. | licences available see
    You lose and Bill collects. | http://www.sohara.org/

    --- SoupGate-Win32 v1.05
    * Origin: Agency HUB, Dunedin - New Zealand | Fido<>Usenet Gateway (3:770/3)
  • From Martin Gregorie@3:770/3 to Ahem A Rivet's Shot on Mon Jan 4 13:58:29 2021
    On Mon, 04 Jan 2021 12:24:31 +0000, Ahem A Rivet's Shot wrote:

    On Mon, 4 Jan 2021 11:33:43 -0000 (UTC)
    Martin Gregorie <martin@mydomain.invalid> wrote:

    Financial systems never use floating point for accuracy reasons:
    consequently integers are used to hold currency amounts: sterling
    amounts are held as pence, euros and dollars as cents and the
    equivalent convention is used for all other currencies.

    I gather that micro-cents/pence are sometimes used when interest calculations are involved and the fractions matter, I've used
    milli-pence.

    Fair comment - I've not run into that requirement, but most of the stuff
    I worked on was financial networks and related systems. Some had multi- currency capability, so were concerned with exchange rates rather than
    interest calculation.


    --
    --
    Martin | martin at
    Gregorie | gregorie dot org

    --- SoupGate-Win32 v1.05
    * Origin: Agency HUB, Dunedin - New Zealand | Fido<>Usenet Gateway (3:770/3)
  • From Dennis Lee Bieber@3:770/3 to All on Mon Jan 4 10:21:32 2021
    On Mon, 4 Jan 2021 13:58:29 -0000 (UTC), Martin Gregorie <martin@mydomain.invalid> declaimed the following:


    Fair comment - I've not run into that requirement, but most of the stuff
    I worked on was financial networks and related systems. Some had multi- >currency capability, so were concerned with exchange rates rather than >interest calculation.

    M$ Excel "Currency" number type internally stores four decimal places (scaled 64-bit integer), even though only two places are displayed. It
    allows for the accumulation of fractional cents https://bettersolutions.com/vba/numbers/currency-data-type.htm

    Other than my COBOL courses in the late 70s, my 35 year programming life was pretty much all floating point data with some string manipulation. Satellite ephemerides, radio wave propagation/signal strength, etc.


    --
    Wulfraed Dennis Lee Bieber AF6VN
    wlfraed@ix.netcom.com http://wlfraed.microdiversity.freeddns.org/

    --- SoupGate-Win32 v1.05
    * Origin: Agency HUB, Dunedin - New Zealand | Fido<>Usenet Gateway (3:770/3)
  • From Dennis Lee Bieber@3:770/3 to All on Mon Jan 4 11:01:53 2021
    On Mon, 4 Jan 2021 12:03:27 -0000 (UTC), Martin Gregorie <martin@mydomain.invalid> declaimed the following:


    No problem. At least this made me look at the PIC architecture and
    discover that it doesn't handle signed integers - I think its the only
    system I've know of at that doesn't, so I didn't realise at first that
    this limitation is in the hardware rather than a feature of the BASIC >compiler.

    The base BS2 uses a PIC16C57c (the BS2e, sx, p24/p40, pe, and px all used variants of Ubicom chips -- given the lack of information online, I suspect they were custom designed for Parallax alone -- ha! "The SX line of microprocessors are produced by Ubicom, Parallax is the only authorized distributor of the chips.")

    From the manual

    """
    All BS2 models can interpret twos complement negative numbers correctly
    in DEBUG and SEROUT instructions using formatters like SDEC (for
    signed decimal). In calculations, however, it assumes that all values are positive. This yields correct results with two’s complement negative
    numbers for addition, subtraction, and multiplication, but not for division
    """


    Hmmm, Parallax finally released a Propeller 2 chip. https://www.parallax.com/propeller-multicore-concept/ and appear to have discontinued all BASIC Stamps (not a surprise -- last time I checked a BS2p
    was around $70 while a Propeller Quickstart is only $40.

    Propellers are interesting chips... 8 simple cores running in lockstep; each core has some internal RAM for programs (so it can be different code
    in each core) written in assembler. The default mode is that the core is
    loaded with a byte-code interpreter, and SPIN programs are read from
    external memory. The P1 allowed one core at a time to access external
    memory (in sequence); the new P2 apparently allows all 8 cores to do memory
    I/O on each cycle.


    --
    Wulfraed Dennis Lee Bieber AF6VN
    wlfraed@ix.netcom.com http://wlfraed.microdiversity.freeddns.org/

    --- SoupGate-Win32 v1.05
    * Origin: Agency HUB, Dunedin - New Zealand | Fido<>Usenet Gateway (3:770/3)
  • From Martin Gregorie@3:770/3 to Dennis Lee Bieber on Mon Jan 4 15:33:44 2021
    On Mon, 04 Jan 2021 10:21:32 -0500, Dennis Lee Bieber wrote:

    On Mon, 4 Jan 2021 13:58:29 -0000 (UTC), Martin Gregorie <martin@mydomain.invalid> declaimed the following:


    Fair comment - I've not run into that requirement, but most of the stuff
    I worked on was financial networks and related systems. Some had multi- >>currency capability, so were concerned with exchange rates rather than >>interest calculation.

    M$ Excel "Currency" number type internally stores four decimal
    places
    (scaled 64-bit integer), even though only two places are displayed. It
    allows for the accumulation of fractional cents https://bettersolutions.com/vba/numbers/currency-data-type.htm

    Other than my COBOL courses in the late 70s, my 35 year
    programming
    life was pretty much all floating point data with some string
    manipulation.
    Satellite ephemerides, radio wave propagation/signal strength, etc.

    Somewhat different to me, then: I joined ICL from Uni (so 1900, 2903
    [desk-size 1900 emu on 2900 DFC hardware] and 2966 kit) writing PLAN
    assembler, macro-generator and COBOL on Georges 1,2,3 and VME/B), worked
    for small software houses after ICL, then joined Logica's finance group
    where my first boss was Graham Sainsbury (who designed the CHAPS
    network), hence financial networks, ATM networks etc.


    --
    --
    Martin | martin at
    Gregorie | gregorie dot org

    --- SoupGate-Win32 v1.05
    * Origin: Agency HUB, Dunedin - New Zealand | Fido<>Usenet Gateway (3:770/3)
  • From Martin Gregorie@3:770/3 to Dennis Lee Bieber on Mon Jan 4 17:15:45 2021
    On Mon, 04 Jan 2021 11:01:53 -0500, Dennis Lee Bieber wrote:

    Propellers are interesting chips... 8 simple cores running in
    lockstep;
    each core has some internal RAM for programs (so it can be different
    code in each core) written in assembler. The default mode is that the
    core is loaded with a byte-code interpreter, and SPIN programs are read
    from external memory. The P1 allowed one core at a time to access
    external memory (in sequence); the new P2 apparently allows all 8 cores
    to do memory I/O on each cycle.

    They sound interesting. I heard of them soon after they were released,
    but you've just increased my knowledge about them by about 500%.

    Out of pure curiosity: have you any idea how much work it would be to
    convert a fully debugged BS2 BASIC program into a running SPIN program?


    --
    --
    Martin | martin at
    Gregorie | gregorie dot org

    --- SoupGate-Win32 v1.05
    * Origin: Agency HUB, Dunedin - New Zealand | Fido<>Usenet Gateway (3:770/3)
  • From Dennis Lee Bieber@3:770/3 to All on Mon Jan 4 14:03:31 2021
    On Mon, 4 Jan 2021 17:15:45 -0000 (UTC), Martin Gregorie <martin@mydomain.invalid> declaimed the following:



    Out of pure curiosity: have you any idea how much work it would be to
    convert a fully debugged BS2 BASIC program into a running SPIN program?

    Probably a lot. One concept with the Propeller is that one assigns cores to do what would have been an interrupt in other chips (instead of
    having an interrupt, that core is in a polling loop). Also using cores for dedicated I/O protocols. The GPIOs are shared by all cogs.

    Manual for the P1 is at https://www.parallax.com/package/propeller-manual/ Besides SPIN and
    Propeller ASM, there is a third-party "SimpleIDE" which provides "Propeller
    C" (https://www.parallax.com/downloads/propeller-c-software/)


    An old demo program:
    -=-=-
    {{
    Welcome.spin

    Welcome to the OpenSource PropellerIDE.

    To run this program:

    * Make sure the FTDI Chip USB driver is installed.
    * Connect the USB Propeller board.
    * Debug (F8)

    The program should pause a moment, print Hello, and
    then toggle Propeller IO P27 repeatedly.
    }}

    CON

    _clkmode = XTAL1 + PLL16X
    _clkfreq = 80_000_000

    OBJ
    ser : "Parallax Serial Terminal"

    PUB start
    ser.start(115200)
    waitcnt(CLKFREQ/2+CNT) '' Wait for start up
    ser.str(string($d,"Hello.",$d))
    blink

    ''
    '' Blink ActivityBoard LED
    ''
    PUB blink '' The start method
    DIRA[27] |= 1 '' Set P27 to output
    repeat '' Repeat forever
    OUTA[27] ^= 1 '' Toggle LED pin
    waitcnt(CLKFREQ/2+CNT) '' Wait

    -=-=-
    And the source code for the main file from DefCon22 badge (the badge uses
    all cogs, one file per cog)
    -=-=-
    '' =============================================================================== ==================
    ''
    '' File....... dc22_badge_master.spin
    '' -- for internal use only!
    '' -- no changes unless approved/reviewed by JonnyMac/Ryan
    ''
    '' Authors.... Jon "JonnyMac" McPhalen and Ryan "1o57" Clarke
    '' MIT License
    '' -- see below for terms of use
    ''
    '' E-mail..... jon@jonmcphalen.com
    '' 1o57@10000100001.org
    ''
    '' Modified for Propeller Quickstart Board (touch pads and LEDs) with Human Interface
    '' Device board (I/R emitter/receiver, LEDs). Also modified to read
    pads to set "Goon"
    '' mode on start-up
    '' Dennis L Bieber
    ''
    '' =============================================================================== ==================

    {{

    Welcome to Defcon 22. This year we would like to invite you to experiment more fully with your
    badge -- feel free to play around with code.

    You can load directly to RAM [F10] if you don't want to blast your
    firmware, but even if you do,
    we are giving you the source from the start. The source provides a nice
    badge template with extra
    objects so that you can experiment with LEDs, buttons, IR (in and out), timing, speed changes, etc.

    Completing the challenge will at some point require you to 'update' your badge -- but for now, how
    about changing your LED pattern? It's easier than you think! If you need help, feel free to stop
    by the Hardware Hacking Village, or simply ask someone who has a
    different pattern than yours.
    Create a new pattern -- have fun!

    }}


    con { timing }

    _clkmode = xtal1 + pll16x
    _xinfreq = 5_000_000 ' use 5MHz crystal

    CLK_FREQ = ((_clkmode - xtal1) >> 6) * _xinfreq ' system
    freq as a constant
    MS_001 = CLK_FREQ / 1_000 ' ticks in
    1ms
    US_001 = CLK_FREQ / 1_000_000 ' ticks in
    1us


    ' speed settings for power control/reduction
    ' -- use with clkset() instruction

    XT1_P16 = %0_1_1_01_111 ' 16x
    crystal (5MHz) = 80MHz
    XT1_PL8 = %0_1_1_01_110
    XT1_PL4 = %0_1_1_01_101
    XT1_PL2 = %0_1_1_01_100
    XT1_PL1 = %0_1_1_01_011
    RC_SLOW = %0_0_0_00_001 ' 20kHz


    ' program speed and terminal baud

    B_SPEED = 20 { MHz }
    T_BAUD = 57_600 { for terminal io }


    IR_FREQ = 36_000 { matches receiver on DC22 badge }
    IR_BAUD = 2400 { max supported using IR connection }
    IR_BLAST = $DC22


    'con
    '
    #0, HUMAN, ARTIST, PRESS, SPEAKER, VENDOR, CONTEST, GOON, UBER, LO57
    '
    ' BADGE_TYPE = HUMAN


    con { io pins }

    RX1 = 31 '
    programming / terminal
    TX1 = 30

    SDA = 29 ' eeprom /
    i2c
    SCL = 28

    PAD3 = 4 '27 ' touch
    pads
    PAD2 = 5 '26 ' HID SD
    slot uses 0-3, sems to conflict
    PAD1 = 6 '25
    PAD0 = 7 '24

    LED7 = 23 ' leds
    LED6 = 22
    LED5 = 21
    LED4 = 20
    LED3 = 19
    LED2 = 18
    LED1 = 17
    LED0 = 16

    IR_IN = 9 '15 ' ir input
    IR_OUT = 8 '14 ' ir output


    con { io configuration }

    IS_OFF = 0 ' all bits
    off
    IS_ON = -1 ' all bits
    on

    IS_LOW = 0
    IS_HIGH = -1

    IS_INPUT = 0
    IS_OUTPUT = -1


    con { pst formatting }

    #1, HOME, GOTOXY, #8, BKSP, TAB, LF, CLREOL, CLRDN, CR
    #14, GOTOX, GOTOY, CLS


    obj

    term : "cryptofullduplexserial64" ' serial io
    for terminal
    irtx : "jm_sircs_tx" ' SIRCS
    output
    irrx : "jm_sircs_rx" ' SIRCS
    input
    prng : "jm_prng" ' random #s
    tmr1 : "jm_eztimer" '
    asynchronous timer
    ee : "jm_24xx512" ' eeprom
    access
    pwm : "jm_pwm8" ' pwm for
    LEDs
    btn : "touch buttons" ' QuickStart buttons are more sensitive?


    var

    long ms001 ' system
    ticks per millisecond
    long us001 ' system
    ticks per microsecond
    byte BADGE_TYPE 'TBD --
    change type on boot


    pub main | idx, last, button

    setup ' setup
    badge io and objects

    term.tx(CLS) ' clear the terminal

    if (BADGE_TYPE => GOON) ' check
    badge type
    alien_badge


    ' non-Goon badge code here

    repeat until (read_pads <> %0000) ' wait for
    a pad press
    idx := (prng.random >> 1) // 13
    repeat (idx << 1)
    term.tx(" ")
    idx := (prng.random >> 1) // 13
    term.caesar(@@Commands[idx])
    if (check_ir)
    quit
    pause(250)

    term.tx(CLS)

    term.caesar(@Greets)
    term.tx(CR)

    term.otp(@Test3, @Test4)
    term.tx(CR)

    last := -1 ' any
    button to start

    repeat
    repeat
    check_ir ' check ir process
    button := read_pads ' wait for input
    until ((button <> %0000) and (button <> last)) ' must be
    new
    last := button ' save for
    next check

    case button
    %0001:
    start_animation(@Cylon, 0) ' start animation
    term.caesar(@Detective) ' display crypto string
    pause(250) ' allow
    clean button release

    %0101:
    start_animation(@Chaser, 0)
    term.otp(@Scientist, @Driver)
    pause(250)

    %0111:
    start_animation(@Police, 0)
    term.caesar(@Diver)
    pause(250)

    %1000:
    start_animation(@InOut, 0)
    term.otp(@Politician, @Football)
    pause(250)

    %1001:
    stop_animation
    term.otp(@RayNelson, @Mystery)
    pause(250)


    pub check_ir | code

    code := irrx.rxcheck ' check ir input

    if (code < 0) ' abort if waiting
    return

    if (code == IR_BLAST)
    start_animation(@Blasted, 3) term.caesar(string($0A, "DROI VSFO GO CVOOZ", CR)) ' THEY LIVE WE SLEEP
    repeat while (anicog) ' let
    animation finish

    irrx.enable

    if (code == IR_BLAST)
    return TRUE


    pub alien_badge | btns, delay

    '' Badge code for >= Goon

    delay := -1 ' force immediate broadcast

    repeat
    btns := read_pads
    if ((read_pads) or (tmr1.seconds => delay)) ' pad input
    or delay expired?
    irtx.tx(IR_BLAST, 16, 3) ' blast the humans!
    'term.caesar(string($0C, "IQ XUHQ FTQK EXQQB", CR)) ' WE LIVE
    THEY SLEEP
    start_animation(@Blasted, 3) ' play
    blaster animation
    tmr1.start ' restart
    timer
    delay := ||(prng.random) // 11 + 10 ' new delay


    pub setup

    '' Setup badge IO and objects
    '' -- set speed before starting other objects

    set_speed(B_SPEED) ' set badge speed (MHz)

    set_leds(%00000000) ' LEDs off

    term.start(RX1, TX1, %0000, T_BAUD) ' start terminal

    prng.seed(cnt << 2, cnt, $1057, -cnt, cnt ~> 2) ' seed prng (random #s)

    btn.Start(CLK_FREQ / 100) ' start button
    reading process

    BADGE_TYPE := HUMAN 'read_pads ' somehow need to
    set up on pads

    if (BADGE_TYPE < GOON)
    irrx.start(IR_IN) ' start ir input
    irrx.enable ' accept ir input now
    else
    irtx.start(IR_OUT, IR_FREQ) ' start ir output
    tmr1.start ' start
    timer


    con

    { ----------------------------- }
    { B A D G E F E A T U R E S }
    { ----------------------------- }


    pub set_speed(mhz)

    '' Sets badge clock speed
    '' -- sets timing variables ms001 and us001
    '' -- note: objects may require restart after speed change

    case mhz
    0: clkset(RC_SLOW, 20_000) ' super low power -- sleep mode only!
    5: clkset(XT1_PL1, 5_000_000)
    10: clkset(XT1_PL2, 10_000_000)
    20: clkset(XT1_PL4, 20_000_000)
    40: clkset(XT1_PL8, 40_000_000)
    80: clkset(XT1_P16, 80_000_000)

    waitcnt(cnt + (clkfreq / 100)) ' wait
    ~10ms

    ms001 := clkfreq / 1_000 ' set ticks
    per millisecond for waitcnt
    us001 := clkfreq / 1_000_000 ' set ticks
    per microsecond for waitcnt


    pub set_leds(pattern)

    '' Sets LED pins to output and writes pattern to them
    '' -- swaps LSB/MSB for correct binary output

    outa[LED0..LED7] := pattern ' write
    pattern to LEDs
    dira[LED0..LED7] := IS_HIGH ' make LED
    pins outputs


    pub read_pads | btns, lwr, upr, wid

    lwr := PAD3 <# PAD0 'determine lowest
    pad in set
    upr := PAD3 #> PAD0 'determine highest
    pad in set
    wid := upr - lwr + 1 'determine width of used pads

    btns := btn.state >> lwr ' shift buttons by lower of
    PAD specification

    btns := btns & !($FFFF << wid) ' generate bitmask for only
    the desired set

    return btns

    ' outa[PAD0..PAD3] := IS_HIGH ' charge
    pads (all output high)
    ' dira[PAD0..PAD3] := IS_OUTPUT

    ' dira[PAD0..PAD3] := IS_INPUT ' float
    pads
    ' pause(50) ' -- allow touch to discharge

    ' return (!ina[PAD0..PAD3] & $0F)' >< 4 ' return
    "1" for touched pads



    con

    { --------------- }
    { L E D F U N }
    { --------------- }


    var

    long anicog ' cog
    running animation
    long anistack[32] ' stack
    space for Spin cog


    pri start_animation(p_table, cycles)

    '' Start animation in background cog
    '' -- allows LED animation while doing other processes
    '' -- p_table is pointer (address of) animation table
    '' -- set cycles to 0 to run without stopping

    stop_animation

    anicog := cognew(run_animation(p_table, cycles), @anistack) + 1

    return anicog ' return
    cog used


    pri stop_animation

    '' Stop animation if currently running

    if (anicog) ' if
    running
    cogstop(anicog - 1) ' stop the
    cog
    anicog := 0 ' mark
    stopped


    pri run_animation(p_table, cycles) | p_leds

    '' Run animation
    '' -- p_table is pointer (address of) animation table
    '' -- cycles is number of iterations to run
    '' * 0 cycles runs "forever"
    '' -- usually called with start_animation()

    if (cycles =< 0)
    cycles := POSX ' run
    "forever"

    repeat cycles
    p_leds := p_table ' point to table
    repeat byte[p_leds++] ' repeat
    for steps in table
    set_leds(byte[p_leds++]) ' update
    leds
    pause(byte[p_leds++]) ' hold

    anicog := 0 ' mark
    stopped
    cogstop(cogid) ' stop this
    cog


    dat

    ' Animation tables for LEDs
    ' -- 1st byte is number of steps in animation sequence
    ' -- each step holds pattern and hold time (ms)
    ' -- for delays > 255, duplicate pattern + delay

    Cylon byte (@Cylon_X - @Cylon) / 2 + 1
    byte %10000000, 125
    byte %01000000, 125
    byte %00100000, 125
    byte %00010000, 125
    byte %00001000, 125
    byte %00000100, 125
    byte %00000010, 125
    byte %00000001, 125
    byte %00000010, 125
    byte %00000100, 125
    byte %00001000, 125
    byte %00010000, 125
    byte %00100000, 125
    Cylon_X byte %01000000, 125


    Chaser byte (@Chaser_X - @Chaser) / 2 + 1
    byte %10010010, 75
    byte %00100100, 75
    Chaser_X byte %01001001, 75


    InOut byte (@InOut_X - @InOut) / 2 + 1
    byte %10000001, 100
    byte %01000010, 100
    byte %00100100, 100
    byte %00011000, 100
    byte %00100100, 100
    InOut_X byte %01000010, 100


    Police byte (@Police_X - @Police) / 2 + 1
    byte %11001100, 75
    byte %11110000, 75
    byte %11001100, 75
    byte %11110000, 75
    byte %00001111, 75
    byte %00110011, 75
    byte %00001111, 75
    Police_X byte %00110011, 75


    Blasted byte (@Blasted_X - @Blasted) / 2 + 1
    byte %00000000, 50
    byte %00011000, 50
    byte %00111100, 50
    byte %01111110, 50
    byte %11111111, 50
    byte %00000000, 50
    byte %00011000, 50
    byte %00111100, 50
    byte %01111110, 50
    byte %11111111, 50
    byte %00000000, 50
    byte %00011000, 50
    byte %00111100, 50
    byte %01111110, 50
    byte %11111111, 50
    byte %00000000, 50
    byte %11111111, 50
    byte %00000000, 50
    byte %11111111, 50
    byte %00000000, 50
    byte %11111111, 50
    byte %00000000, 50
    byte %11111111, 50
    byte %00000000, 50
    byte %11111111, 50
    Blasted_X byte %00000000, 50


    con

    { ------------- }
    { B A S I C S }
    { ------------- }


    pub pause(ms) | t

    '' Delay program in milliseconds
    '' -- ensure set_speed() used before calling

    t := cnt ' sync to system counter
    repeat (ms #>= 0) ' delay > 0
    waitcnt(t += ms001) ' hold 1ms


    pub high(pin)

    '' Makes pin output and high

    outa[pin] := IS_HIGH
    dira[pin] := IS_OUTPUT


    pub low(pin)

    '' Makes pin output and low

    outa[pin] := IS_LOW
    dira[pin] := IS_OUTPUT


    pub toggle(pin)

    '' Toggles pin state

    !outa[pin]
    dira[pin] := IS_OUTPUT


    pub input(pin)

    '' Makes pin input and returns current state

    dira[pin] := IS_INPUT

    return ina[pin]


    pub pulse_out(pin, us) | state

    '' Generate pulse on pin for us microseconds
    '' -- ensure set_speed() used before calling
    '' -- makes pin output
    '' -- pulse out is opposite of pin's input state
    '' -- blocks until pulse is finished (to clear counter)

    us *= us001 ' convert
    us to system ticks
    state := ina[pin] ' read
    incoming state of pin

    if (ctra == 0) ' ctra available?
    if (state == 0) '
    low-high-low
    low(pin) ' set to
    output
    frqa := 1
    phsa := -us ' set
    timing
    ctra := (%00100 << 26) | pin ' start the pulse
    repeat
    until (phsa => 0) ' let pulse finish

    else '
    high-low-high
    high(pin)
    frqa := -1
    phsa := us
    ctra := (%00100 << 26) | pin
    repeat
    until (phsa < 0)

    ctra := IS_OFF ' release counter
    return true

    elseif (ctrb == 0)
    if (state == 0)
    low(pin)
    frqb := 1
    phsb := -us
    ctrb := (%00100 << 26) | pin
    repeat
    until (phsb => 0)

    else
    high(pin)
    frqb := -1
    phsb := us
    ctrb := (%00100 << 26) | pin
    repeat
    until (phsb < 0)

    ctrb := IS_OFF
    return true

    else
    return false ' alert
    user of error


    pub set_freq(ctrx, px, fx)

    '' Sets ctrx to frequency fx on pin px (NCO/SE mode)
    '' -- fx in hz
    '' -- use fx of 0 to stop counter that is running

    if (fx > 0)
    fx := ($8000_0000 / (clkfreq / fx)) << 1 ' convert
    freq for NCO mode
    case ctrx
    "a", "A":
    ctra := ((%00100) << 26) | px ' configure ctra for NCO on pin
    frqa := fx ' set
    frequency
    dira[px] := IS_OUTPUT

    "b", "B":
    ctrb := ((%00100) << 26) | px
    frqb := fx
    dira[px] := IS_OUTPUT

    else
    case ctrx
    "a", "A":
    ctra := IS_OFF ' disable counter
    outa[px] := IS_OFF ' clear pin/driver
    dira[px] := IS_INPUT

    "b", "B":
    ctrb := IS_OFF
    outa[px] := IS_OFF
    dira[px] := IS_INPUT


    dat

    RayNelson byte "IAIHG TPJNU QU CZR GALWXK DC MHR LANK FOTLA OTN
    LOYOC HPMPB PX HKICW",0
    Test4 byte "DID YOU REALLY THINK THAT IT WOULD BE SO EASY?
    Really? Just running strings?",0
    Greets byte 16,77,85,66,83,69,67,85,32,74,69,32,84,85,86,83,69,68,32,74,77,85,68,74,79,32,7 4,77,69,13,0
    Detective byte 13,74,85,82,69,82,32,71,66,32,79,82,84,86,65,32,86,32,88,65,66,74,32,83,86,65,8 1,32,85,78,69,66,89,81,13,0
    Scientist byte 76,81,84,89,86,70,32,82,75,66,32,83,78,90,32,83,81,87,83,85,32,87,82,65,32,73,7 7,82,66,32,67,70,72,82,32,90,65,65,65,65,32,73,89,77,87,90,32,80,32,69,65,74,81 ,86,68,32,89,79,84,80,32,76,71,65,87,32,89,75,90,76,13,0
    Diver byte 10,"DBI DRO PSBCD RKVP YP RSC ZRYXO XEWLOB PYVVYGON
    LI RSC VKCD XKWO DROX DRO COMYXN RKVP YP RSC XEWLOB",CR,0
    Driver byte "SOMETIMES WE HAVE ANSWERS AND DONT EVEN KNOW IT SO ENJOY THE VIEW JUST BE HAPPY",0
    Politician byte 83,83,80,87,76,77,32,84,72,67,65,80,32,81,80,32,74,84,32,73,87,69,32,87,68,88,7 0,90,32,89,85,90,88,32,85,77,86,72,88,72,32,90,65,32,67,66,32,80,65,69,32,88,82 ,79,76,32,70,65,89,32,73,80,89,75,13,0
    Test3 byte "ZGJG MTM LLPN C NTER MPMH TW",CR,0
    Football byte "IT MIGHT BE HELPFUL LATER IF YOU KNOW HOW TO GET
    TO EDEN OR AT LEAST THE WAY",0
    Mystery byte "OH A MYSTERY STRING I SHOULD HANG ON TO THIS FOR
    LATER I WONDER WHAT ITS FOR OR WHAT IT DECODES TO?",0


    dat

    Cmd00 byte $05, $42, $54, $57, $50, $20, $4A, $4E, $4C, $4D,
    $59, $20, $4D, $54
    byte $5A, $57, $58, $0D, $00, $4C, $4F, $56, $45, $00
    Cmd01 byte $04, $41, $45, $58, $47, $4C, $20, $58, $5A, $0D,
    $00
    Cmd02 byte $0E, $47, $49, $50, $41, $57, $48, $0D, $00, $4C,
    $49, $46, $45, $00
    Cmd03 byte $0C, $45, $46, $4D, $4B, $20, $4D, $45, $58, $51,
    $51, $42, $0D, $00
    Cmd04 byte $04, $53, $46, $49, $43, $0D, $00, $47, $69, $47,
    $21, $00
    Cmd05 byte $14, $48, $49, $20, $43, $48, $58, $59, $4A, $59,
    $48, $58, $59, $48
    byte $4E, $20, $4E, $42, $49, $4F, $41, $42, $4E, $0D,
    $00
    Cmd06 byte $02, $50, $51, $20, $4B, $4F, $43, $49, $4B, $50,
    $43, $56, $4B, $51
    byte $50, $0D, $00, $4A, $6F, $6E, $6E, $79, $4D, $61,
    $63, $00
    Cmd07 byte $0C, $59, $4D, $44, $44, $4B, $20, $4D, $5A, $50,
    $20, $44, $51, $42
    byte $44, $41, $50, $47, $4F, $51, $0D, $00, $48, $41,
    $50, $50, $59, $00
    Cmd08 byte $05, $4A, $46, $59, $0D, $00, $48, $45, $41, $4C,
    $54, $48, $00
    Cmd09 byte $09, $4D, $58, $20, $57, $58, $43, $20, $5A, $44,
    $4E, $42, $43, $52
    byte $58, $57, $20, $4A, $44, $43, $51, $58, $41, $52,
    $43, $48, $0D, $00
    Cmd10 byte $0F, $52, $44, $43, $48, $4A, $42, $54, $0D, $00
    Cmd11 byte $02, $45, $51, $50, $48, $51, $54, $4F, $0D, $00
    Cmd12 byte $19, $41, $54, $58, $0D, $00, $57, $45, $41, $4C,
    $54, $48, $00
    byte $31, $6F, $35, $37, $00

    Commands word @Cmd00, @Cmd01, @Cmd02, @Cmd03, @Cmd04, @Cmd05
    word @Cmd06, @Cmd07, @Cmd08, @Cmd09, @Cmd10, @Cmd11
    word @Cmd12


    dat

    {{

    Terms of Use: MIT License

    Permission is hereby granted, free of charge, to any person obtaining a
    copy of this
    software and associated documentation files (the "Software"), to deal in
    the Software
    without restriction, including without limitation the rights to use,
    copy, modify,
    merge, publish, distribute, sublicense, and/or sell copies of the
    Software, and to
    permit persons to whom the Software is furnished to do so, subject to the following
    conditions:

    The above copyright notice and this permission notice shall be included
    in all copies
    or substantial portions of the Software.

    THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
    OR IMPLIED,
    INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
    FOR A
    PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
    HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
    AN ACTION OF
    CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH
    THE SOFTWARE
    OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

    }}


    --
    Wulfraed Dennis Lee Bieber AF6VN
    wlfraed@ix.netcom.com http://wlfraed.microdiversity.freeddns.org/

    --- SoupGate-Win32 v1.05
    * Origin: Agency HUB, Dunedin - New Zealand | Fido<>Usenet Gateway (3:770/3)
  • From Jan Panteltje@3:770/3 to wlfraed@ix.netcom.com on Tue Jan 5 06:17:47 2021
    On a sunny day (Mon, 04 Jan 2021 14:03:31 -0500) it happened Dennis Lee Bieber <wlfraed@ix.netcom.com> wrote in <02o6vf5rke2l2seqn49iehasqblkenvhv7@4ax.com>:

    On Mon, 4 Jan 2021 17:15:45 -0000 (UTC), Martin Gregorie ><martin@mydomain.invalid> declaimed the following:



    Out of pure curiosity: have you any idea how much work it would be to >>convert a fully debugged BS2 BASIC program into a running SPIN program?

    Probably a lot. One concept with the Propeller is that one assigns
    cores to do what would have been an interrupt in other chips (instead of >having an interrupt, that core is in a polling loop). Also using cores for >dedicated I/O protocols. The GPIOs are shared by all cogs.
    ....

    If I read this it makes me wonder why not go FPGA, learn Verilog for example. Then you can basically create your own processor, cores, and it is widely used and
    proven technology, also with a wide experimental open source user base:
    https://opencores.org/projects
    make your own processor, elect one!:
    https://opencores.org/projects?expanded=Processor

    FPGA boards are cheap on ebay these days.
    It also enhances your value on the IT market.
    It helps to have hardware design experience.
    IIRC there also is an FPGA HAT for Raspberry.

    Design your own processor, with your own instruction set...
    Sky is the limit, as is speed it seems.

    --- SoupGate-Win32 v1.05
    * Origin: Agency HUB, Dunedin - New Zealand | Fido<>Usenet Gateway (3:770/3)
  • From =?UTF-8?Q?Bj=c3=b6rn_Lundin?=@3:770/3 to All on Sat Jan 23 23:03:39 2021
    Den 2021-01-04 kl. 04:17, skrev The Natural Philosopher:
    On 03/01/2021 19:15, Charlie Gibbs wrote:
    On 2021-01-03, Joe <joe@jretrading.com> wrote:

    On Sun, 03 Jan 2021 15:41:04 GMT
    Jan Panteltje <pNaOnStPeAlMtje@yahoo.com> wrote:

      I use an asm math library written by someone else,
    so far 32 bit integer was all I needed,

      "If you need to use floating-point arithmetic in FORTH,
      you do not fully understand your application"

    Not sure if it was Charles Moore or Leo Brodie who said that.

    It makes sense, though, depending on your applications.
    In 50 years of commercial programming, I can count the
    number of times I've used floating point on the fingers
    of one hand.

    Odd. I use it extensively. Not for money oriented stuff tho


    Money should use Fixed type. <https://en.wikipedia.org/wiki/Fixed-point_arithmetic#Computer_language_implementations>


    --
    Björn

    --- SoupGate-Win32 v1.05
    * Origin: Agency HUB, Dunedin - New Zealand | Fido<>Usenet Gateway (3:770/3)
  • From Martin Gregorie@3:770/3 to All on Sat Jan 23 22:54:30 2021
    On Sat, 23 Jan 2021 23:03:39 +0100, Björn Lundin wrote:

    Den 2021-01-04 kl. 04:17, skrev The Natural Philosopher:
    On 03/01/2021 19:15, Charlie Gibbs wrote:
    On 2021-01-03, Joe <joe@jretrading.com> wrote:

    On Sun, 03 Jan 2021 15:41:04 GMT Jan Panteltje
    <pNaOnStPeAlMtje@yahoo.com> wrote:

      I use an asm math library written by someone else,
    so far 32 bit integer was all I needed,

      "If you need to use floating-point arithmetic in FORTH,
      you do not fully understand your application"

    Not sure if it was Charles Moore or Leo Brodie who said that.

    It makes sense, though, depending on your applications.
    In 50 years of commercial programming, I can count the number of times
    I've used floating point on the fingers of one hand.

    Odd. I use it extensively. Not for money oriented stuff tho


    Money should use Fixed type.
    <https://en.wikipedia.org/wiki/Fixed-
    point_arithmetic#Computer_language_implementations>

    Depends: Thats OK for a single currency system, but if you need to handle multi-currency, then you need at least three variables to describe a
    financial amount:

    long int value;
    int decimalPlace;
    String currencyName;

    where value is the value in the smallest legal unit (pence for GBP, cents
    for Euros or dollars and decimalPlace (2 for GBP and most other
    currencies, though IIRC there are a few that use 3 decilal places, is
    only used when converting to or from human-readable strings.

    In practise you may need quite a complex currency parser, because a lot
    of bankers and finance traders would expect the system to understand,
    say, USD1.5M as meaning "$1,500,000.00 US" and would expect to use that shorthand notation when entering payment details and to get the amount displayed the same way if they need to amend it later.

    ====

    And yet, way back when having a PC with an 8086 in it was a sign of
    status, and PC financial programs where written in BASIC, the use of
    floating point for financial values was fairly common - but only because
    a 16 bit signed integer topped out at a mere GBP 327.68 OR were achingly
    slow because they had to use BCD or decimal encoded monetary values.

    The Mainframes I've worked on have ALWAYS used integers for financial
    values, though quite a lot of the weedier bottom-of-the-range IBM boxes
    used BCD - but at least they had BCD hardware and didn't have to do calculations entirely in software.


    --
    --
    Martin | martin at
    Gregorie | gregorie dot org

    --- SoupGate-Win32 v1.05
    * Origin: Agency HUB, Dunedin - New Zealand | Fido<>Usenet Gateway (3:770/3)
  • From Pancho@3:770/3 to Martin Gregorie on Sat Jan 23 23:31:47 2021
    On 23/01/2021 22:54, Martin Gregorie wrote:

    Money should use Fixed type.
    <https://en.wikipedia.org/wiki/Fixed-
    point_arithmetic#Computer_language_implementations>

    Depends: Thats OK for a single currency system, but if you need to handle multi-currency, then you need at least three variables to describe a financial amount:


    For Financial derivative risk systems, it is still almost exclusively float(double) representation for money. The exponential function is
    frequently used in calculations and it works with doubles. Hence the
    added complexity of converting between doubles and decimals far
    outweighs any benefit.

    BTW thank you for the awk idea the other day. If I whinge on about an
    idea for days, it means I like it. I'm a bit of a sperg when it comes to
    social graces.

    --- SoupGate-Win32 v1.05
    * Origin: Agency HUB, Dunedin - New Zealand | Fido<>Usenet Gateway (3:770/3)
  • From Dennis Lee Bieber@3:770/3 to All on Sat Jan 23 18:30:25 2021
    On Sat, 23 Jan 2021 22:54:30 -0000 (UTC), Martin Gregorie <martin@mydomain.invalid> declaimed the following:

    The Mainframes I've worked on have ALWAYS used integers for financial
    values, though quite a lot of the weedier bottom-of-the-range IBM boxes
    used BCD - but at least they had BCD hardware and didn't have to do >calculations entirely in software.

    Even the old Intel 8080a had "BCD hardware" -- but one would have to write the algorithm to work with more than two BCD digits.

    My college computer (Xerox Sigma-6) had BCD hardware. The normal mode used by the COBOL class was BCD (note: Sigma's also used the EBCDIC
    character encoding), 32-digit, using four of the 32-bit general purpose registers at a time. I recall the fall when the BCD board failed -- COBOL students were left twiddling their thumbs or trying to code work-arounds (possibly one of the COMP formats that did not use BCD), whereas the
    FORTRAN-IV students were not impacted. Think it took almost half the term before the BCD board was replaced.


    --
    Wulfraed Dennis Lee Bieber AF6VN
    wlfraed@ix.netcom.com http://wlfraed.microdiversity.freeddns.org/

    --- SoupGate-Win32 v1.05
    * Origin: Agency HUB, Dunedin - New Zealand | Fido<>Usenet Gateway (3:770/3)