Writing to MCU flash

We are talking about a single subtraction in this case. Most C programmers will know what that does.

I agree that many programmers don't know all the details of what they are doing, and especially they don't know about everything that happens underneath. That is the whole point of abstraction layers - and it means people can do their work without knowing /everything/.

(I am the kind of person that /does/ like to know everything, which is one reason I like small systems embedded programming. But I also appreciate when it doesn't matter - my PC programming is mostly in Python.)

I have programmed PIC assembly. Your conclusion is correct.

Reply to
David Brown
Loading thread data ...

David Brown wondered

------------^^^^^^^^^^

I hope your C reading skills are better than your text reading skills?

formatting link
very old code, but sort of maintained used everyday, see headers.

formatting link

Pussy.

I really think you should look up an 18F14K22 datasheet.

:-)

formatting link
formatting link

Your turn.

Reply to
<698839253X6D445TD

You did not include such a link in any of the posts in this thread. Do you expect me to dig through old posts to try to find it?

I have had a quick glance at a couple of files. No, I have nothing to learn here - the style is horrendous. (It is not the worst I have seen, of course.) There was never a time when code written like that was good style, no matter how old it is.

I have read the datasheets of other PIC devices, including the 18xx families. I am very glad that I don't have to program those monstrosities.

(There are many nice things about some of the PIC devices - they can, for example, be extraordinarily robust and reliable. But they are not nice for programming.)

Nope.

Reply to
David Brown

Man you are confused, newsreader versus newsletter ?

Well I can understand it is a bit overwhelming for a starter. Usually takes me some minutes to read up too when I want to modify things..

*Your* view of programming I presume. PICs are simple, those older ones had banks, but so did 8051 etc, making things a bit more complicated perhaps. The instruction set is very efficient, and a lot more instructions than C while case if else some pointers etc ... what more do you want? Z80 was nice too with many instructions some undocumented at that. An old saying over here in this country goes something like: 'what the farmer does not know he does not eat'. Tronics and all those micros is a life long study, walking with keeping your eyes shut is not a smart thing to do.

As expected.

Reply to
<698839253X6D445TD

Verilog is like C in that it's concise, whereas VHDL is verbose like COBOL. (I think VHDL source looks hideous.)

Cheers

Phil Hobbs

--
Dr Philip C D Hobbs 
Principal Consultant 
 Click to see the full signature
Reply to
Phil Hobbs

Yes, I misread "newsreader" for "newsletter". I had assumed that you were talking about a "newsletter" of some kind discussing programming.

I am not a beginner at programming - but I can see that you hadn't learned much about reliable coding before writing that jumble. You should learn a little about interfaces and implementations, and how to write them in C.

The 8051 is braindead too. That does not make the PIC nice.

The Z80 was a great deal more programmer friendly than the PIC or the

8051. (To be fair on the PIC's, the 18xxx series is a big improvement over the 16xxx.)

I'd recommend you open your eyes and see what has happened in the industry in the last 30 years or so. I agree that not all of it is good, but many things have moved forward.

I write embedded code for a living, not just toys for fun. I don't get to publish my clients' code.

But I'd be embarrassed to have something like that newsreader code published in my name.

Reply to
David Brown

Careful there. Olin Lathrop's a professional PIC developer who advocates MPASM over C.

formatting link

Interesting chip.

Thank you,

--
Don Kuenz KB7RPU 
There was a young lady named Bright Whose speed was far faster than light; 
 Click to see the full signature
Reply to
Don Kuenz

That is at most very vaguely true. Compared to VHDL, Verilog is concise. Compared to other HDL's, it involves swaths of unnecessary extra code and verbose coding. Compared to Ada or COBOL, C can be concise - compared to other languages, it requires lots of extra work.

Reply to
David Brown

So there is a developer who has specialised in PIC assembly, and is stuck with it - or he must admit that his company development model is outdated and playing catch-up with others.

OK, virtually no professional developer writes assembly on PICs. Better?

People who develop software professionally need to get a sensible return in terms of code development time. They need to write code that is maintainable, comprehensible, and can be transferred to others. You don't get that with assembly. What you get is longer development times (except perhaps for very simple projects) with code that is bound tightly to particular devices, and bound tightly to particular developers. That's okay if you are doing it all for your own fun - you don't care what other people think. But if a customer is paying you to do development, they need to be able to take that code and work further with it, even if you can't or won't do future maintenance work.

Reply to
David Brown

We did one board that used a uP per channel, partly because each channel had to be electrically isolated. There are 13 CPUs and one FPGA for the VME interface.

formatting link

The dinky little channel CPUs each run an ADC-filter-PID-DAC loop at

200 KHz.
--
John Larkin         Highland Technology, Inc 

lunatic fringe electronics
 Click to see the full signature
Reply to
John Larkin

How do you interact with the electronic designers?

Do you get pulled in after the architecture is frozen, and given a spec to implement? Or are you involved in hardware/software/analog/digital tradeoffs from the start?

Signals and Systems is fun, especially if you have multiple ways to implement it. A filter can be various kinds of analog, FIR in an FPGA, IIR in uP code, whatever works.

We still, rarely, drop down to a bit of asm. It's ugly on an ARM.

--
John Larkin         Highland Technology, Inc 

lunatic fringe electronics
 Click to see the full signature
Reply to
John Larkin

We had a weird problem last week. An ARM talks to an FPGA which implements a bunch of DDS sine wave generators, driving a mess of serial DACs. The sinewaves had weird erratic spikey glitches, which were suspected to be SPI transmission-line problems, but weren't.

Much experimenting and thinking led us to the real problem: a VOLATILE declaration in c wasn't always working, so the sinewave amplitude multiplier values would occasionally get zeroed. One clue was that the glitches were erratic but quantized to 1 ms time ticks, and the ARM runs a 1 KHz interrupt.

I solved the problem by applying the universal principle of "always blame the software."

--
John Larkin         Highland Technology, Inc 

lunatic fringe electronics
 Click to see the full signature
Reply to
John Larkin

That's trivially valid if you include the VHDL/Verilog code in the definition of "software" :)

In cases such as yours, it can be "entertaining" to determine whether to assign the root-cause to the programmer, the compiler, or the language.

With modern C (worse: C++), KISS has disappeared from the language.

Reply to
Tom Gardner

David Brown stated wrote in :

Well, the code is from 1998 (really) some minor things changed later in Usenet, so some minor things were changed in the code. In all those years nothing bad happened, I have a database that goes back to year 2000 or so (old one was lost when harddisk was dropped), and maybe in all those 18 years 18 crashes. I know why, and do not bother. So, now compare that to eeehhh wherewasit redmond.. stuff?

Na, I'v contributed some to that...

I know, everything you do is secret and perfect.

I would be embarrassed too if you published my code in your name :-) Without mentioning source that is.

There was a website long ago that published a clone of my xste (subtitle editor), every time I added some feature they did too (for money that is). Then I announced a feature, it was for a working group, they announced it too. The requirements changed and that feature was no longer needed, so I never implemented it. That website disappeared. Like snow in the sun. Yes many derivates of software I wrote were made by many people all over the world with my consent. Open source is fun. There are always the jealous types, I remember people writing 'that can never work' and stuff like that, 'it has memory leaks all over it' (for the subtitle software), and crap like that, Some had a very specific business interest to attack. None of those are still around AFAIK. You should try open source too. People will rip your code apart, some people will have requests (I implemented several in NewsFleX), read open source code, share it, that is the right way. All your secrecy to me means it is unverifyable and of no value. Your attacks are not specific, and hold no ground. You hide. :-)

Reply to
<698839253X6D445TD

On a sunny day (Mon, 28 Jan 2019 15:21:27 -0000 (UTC)) it happened Don Kuenz wrote in :

Interesting site :-)

Reply to
<698839253X6D445TD

David Brown uttered a mantra:

Mantras are close to religion and people who use them believe those work.

Science is something else.

Reply to
<698839253X6D445TD

Now there's a giveaway. You don't even believe in hardware!

Cheers

Phil Hobbs

--
Dr Philip C D Hobbs 
Principal Consultant 
 Click to see the full signature
Reply to
Phil Hobbs

If A is a float,

A=A+3

could be a big deal.

--
John Larkin         Highland Technology, Inc 
picosecond timing   precision measurement  
 Click to see the full signature
Reply to
John Larkin

We almost always get our PC boards right first try.

Code is almost always wrong as written, and needs many iterations to bet to mostly bug free. VHDL is better than c, mainly because my VHDL guys include a lot of test benching and don't consider the code done until it simulates right. But the first as-typed code is usually wrong.

The idea is that the easier it is to change something, the less effort will be invested in getting it right.

Fun: google spreadsheet errors

Turns out that most spreadsheets are wrong. Billion dollar mistakes have been made.

--
John Larkin         Highland Technology, Inc 
picosecond timing   precision measurement  
 Click to see the full signature
Reply to
John Larkin

Test-driven design is a software development technique that applies that idea to code. You write a description of each function, write a unit test for it, and then write the function.

My son and colleague Simon (formerly known as Dashing Firmware Hunchback) built a build-and-testing framework that he uses for that--the firmware gets mostly debugged on x86, with functions that log and mimic the peripherals. It's way faster than doing it on the target, and of course it can be going on in parallel with the target hardware development. (He's a much more orderly fellow than I am.)

You betcha. The last spreadsheet I used for anything except reading other people's CSVs was Visicalc, circa 1982. I took one look at it, realized that spreadsheets were impossible to debug, and chucked the whole notion.

I do plots using text files + Gnuplot, feasibility calculations with an old version of Mathcad, and otherwise I mostly write something.

Cheers

Phil Hobbs

--
Dr Philip C D Hobbs 
Principal Consultant 
 Click to see the full signature
Reply to
Phil Hobbs

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.