Recent

Author Topic: Pascal-ish Syntax for bit access.  (Read 32662 times)

marcov

  • Administrator
  • Hero Member
  • *
  • Posts: 12314
  • FPC developer.
Re: Pascal-ish Syntax for bit access.
« Reply #60 on: April 05, 2017, 05:07:09 am »
I'm with with Mollly on this one. If you expect an important costfactor, you optimize it to the max. Otherwise you don't start out with the absolute minimum and use something general purpose what you have lying around (instead of doing a new print and a new MCU to make it fit on the smallest size)

The price difference between a pic10 and a 18F or even a fullblown dspic33e is often already spent walking to the coffee machine out of frustration, stocking or shipping fees on yet another MCU model,  or simply being done earlier and not having a "rush" order to the PCB maker.

And there is such an enormous range of mcus between tinyavr and a fullblown arm that makes that argument frankly a hyperbole.

It really sounds like you try to make minimalism sound professional with cost arguments. I gave up the whole 8bit range because the numbers didn't work out when print numbers are below 100, and basically a decent 18F wasn't that much cheaper than a dspic33f (back then, meanwhile migrated to dspic33e The 18F2550 was 4.xx, the toprange 33F motor mcu was 6 or so, but there are several magnitudes inbetween)

Basically our MCU selection process is to select a family, put a hand over our eyes and order the most expensive part in the selected range (the most peripherals) but with the least flash. (our programs are typically 20k, and never over 35, so 512kb is a bit unnecessary) because the whole MCU price difference (with 100-200 prints in a good year) is maybe Eur 100 total, which is already saved if you can do one experiment with a print lying around that has the peripheral you need. For some smaller prints we use a smaller mcu (64pins instead of 144 in the same range to keep the software compat), but the reasons there are more space and easier soldering than cost.

I spend about a 10% of my work time on PIC, rising  to 25% in some periods My fanciest design is a led lamp, 21 x 16 leds that can be turned on and off individually (with 180Hz) and are PWMed per row. New pattern info is over CAN.

p.s. afaik all PC solutions are aggregrated on larger asics that can be programmed in one go instead of many small programmable units to reduce soldering and programming needed. It might be a PIC, but only in design. And fan control isn't as simple as it was in the 486 times nowadays.
« Last Edit: April 05, 2017, 11:51:48 am by marcov »

avra

  • Hero Member
  • *****
  • Posts: 2547
    • Additional info
Re: Pascal-ish Syntax for bit access.
« Reply #61 on: April 05, 2017, 11:36:02 am »
It really sounds like you try to make minimalism sound professional with cost arguments.
No, sorry if it sounded like that. I also like comfort when a project can afford it, but I wanted to point out that there is still a valid use case for using compiler even with smallest devices. Not as much these days as there is a use case for using comfortable XMEGA, dsPIC, PSoC, ESP8266, ARM or something else one over the other depending on the project type, but still valid. Otherwise manufacturers would not make them.

I gave up the whole 8bit range because the numbers didn't work out when print numbers are below 100
There you said it, and I could not agree more. For such small quantities you would save many engineering hours if you provide more powerful  tools and MCUs, but with much higher numbers that calculation can change enough to make it more then worth that extra engineering effort.
ct2laz - Conversion between Lazarus and CodeTyphon
bithelpers - Bit manipulation for standard types
pasettimino - Siemens S7 PLC lib

marcov

  • Administrator
  • Hero Member
  • *
  • Posts: 12314
  • FPC developer.
Re: Pascal-ish Syntax for bit access.
« Reply #62 on: April 05, 2017, 11:54:57 am »
No, sorry if it sounded like that. I also like comfort when a project can afford it, but I wanted to point out that there is still a valid use case for using compiler even with smallest devices.

I think it is dragged in by the hairs. The compilers for those devices only exist because of their big (16F,18F) brethren. Microchip recommends 18F for use with compilers even due to their hw stack, and asm below

Quote
Not as much these days as there is a use case for using comfortable XMEGA, dsPIC, PSoC, ESP8266, ARM or something else one over the other depending on the project type, but still valid. Otherwise manufacturers would not make them.

No need to go so far. There are probably 1200 8-bit pic models alone that are larger.

« Last Edit: April 05, 2017, 05:37:39 pm by marcov »

Edson

  • Hero Member
  • *****
  • Posts: 1325
Re: Pascal-ish Syntax for bit access.
« Reply #63 on: April 05, 2017, 04:55:05 pm »
That's fine. I just prefer
Code: Pascal  [Select][+][-]
  1. if (PinA.LswOn and not PinC.EmOn) then ...
over
Code: Pascal  [Select][+][-]
  1. if (PinA.LswOn = 1) and (PinC.EmOn = 0) then ...
Both work  :D

No need. I'm defining logical operators for the Bit type. So you just need to do:

Code: Pascal  [Select][+][-]
  1. if (PinA.LswOn and not PinC.EmOn) = 1 then ...
Lazarus 2.2.6 - FPC 3.2.2 - x86_64-win64 on Windows 10

 

TinyPortal © 2005-2018