Lol. Only true for those who can't write good code in any language.
Lol. Only true for those who can't write good code in any language.
-- Rick C
Oh dear, you'll be on Gareth's enemy list now.
Oh really?
So I was dreaming about the ones running print registration control retro- fitted to several printing presses. Oh, and the eleven managing a distributed silo control system in a plastics factory that runs 24/7.
I'll exclude the one that controls a production shift changeover, display and information system, seeing as it cheats, and uses an external GPS module for time & date.
-- W J G
ROFL
PIcs used everywhere. mate of mine is controlling specialised power supply for a scientific instrument. PIC does teh PWM to stabilise teh voltage
One in every digital camera too....
-- Future generations will wonder in bemused amazement that the early twenty-first century?s developed world went into hysterical panic over a
I have to assume the term "PIC" is being used incorrectly as a synonym for MCU. PIC is a trade name and MCU is the correct term. If you say PIC, I assume you mean the PIC line of MCUs.
-- Rick C
I regret that you seem to be nit-picking over an irrelevance to the discussion about readability; you discuss the hairs on the skin of the pig and not the flavour of the pork.
But your last 7 lines above illustrate so well the unreadability of Forth being, as it is, an assembly language.
I don't use Fortran
I'm sorry, but you seem to have misunderstood me and then shot off on a tangent.
By discussing the CD player I was referring to the only likely place in a car that you'd find a PIC.
It is only unreadable to those who refuse to learn it. The code Anton posted is very simple and clear. If you can't understand it either you have not at all tried to learn the words he used or you simply are not capable of programming in a new language (to you).
He has mentioned how you made errors in your code that would not have been picked up by the syntax checker. Syntax does not typically find logic flaws.
-- Rick C
Are you saying the single product line that is referred to by the trademark "PIC" or are you using PIC as a synonym for MCU? If the former, so what? If the latter, you are totally wrong. There are dozens of MCUs in the typical auto including the engine controller which was in widespread use two decades ago. Are you driving a 1956 MG or something?
-- Rick C
Let me try to turn this around: most microcontrollers (Atmel AVR, Microchip PIC) now have built-in CAN and LIN controllers. Or they're retrofitted via I2C or SPI.
Does the presence of a CAN bus imply automotive, or is it used elsewhere?
It started as a Bosch designed automotive bus (1983) that has since spread into industrial (SCADA) and aerospace applications.
RaspberryPi and Arduino users can experiment with CAN-bus because there are RaspberryPi expansion cards and Arduino shields that support it.
-- martin@ | Martin Gregorie gregorie. | Essex, UK
It's used for industrial control systems too.
In a previous company we used a whole stack of analogue and digital I/O modules connected via CAN bus to build a 3/4 Hawk fighter plane to train RAF ground crew. Instead of messy and quite dangerous high pressure hydraulics in conventional ground trainers (old or crashed aircraft) it used electronic actuators and optical sensors in the pipework.
Back at the turn of the millennium we were frying early Pentium 90/133s running the I/O control, hydraulic and electrical emulation systems, but we'd be using few Raspberry Pi's if we were doing it today.
---druck
On Wed, 20 Jul 2016 13:34:23 GMT, alister declaimed the following:
PIC16F676 1K instruction, 64 byte RAM (14 pin) PIC16F690 4K instruction, 256 byte RAM (20 pin) PIC16F877A 8K instruction, 368 byte RAM (40 pin) PIC18F2520 16K instruction, 1536 byte RAM (28 pin)
NOTE: instructions tend to be 12-bit for 16F series -- I don't recall if my database is listing #instructions (meaning 1.5KB for the 676) or actual bytes.
-- Wulfraed Dennis Lee Bieber AF6VN wlfraed@ix.netcom.com HTTP://wlfraed.home.netcom.com/
First, a correction to the form of the above expression. According to this page,
the -b is also over the 2a. It would be more accurately written with paper and pencil as this:
______________ x = -b +- / b2 - 4ac \/ ------------------------- 2a
(end of expression form correction)
The assertion that algebraic does not match the way we would express the formula using paper and pencil is not quite true--at least for one definition of algebraic entry.
As implemented by Sharp in the EL-5100 scientific calculator I have used since 1979 or 1980, algebraic entry expresses the above expression in essentially the same way I would write it using paper and pencil--_provided_ I were limited to a single line with paper and pencil. The EL-5100's display has 24 characters, each character being a 5x7 array of dots. Here's how the above expression appears on the EL-5100's display:
(-B+"radical"(B2-4AC))/2A=
The first "-" is a unary minus, which has three dots, whereas the binary minus has five dots.
The "radical" is a single-character symbol that looks exactly the same as I would write it with paper and pencil.
The "2" in "B2" is from the "x^2" key. It is smaller and elevated, so it looks like a superscript, essentially the same as I would write it with paper and pencil.
The "/" is a division symbol that looks like a hyphen with a dot above it and a dot below it.
Note, the 2A is automatically evaluated first, as if there were parentheses around it.
The above evaluates the '+' value. To evaluate the '-' value, I press the "PB" key, which plays back the original expression, arrow-key back and replace the first '+' with a '-', then press the "=" key again.
If I were doing this in Algebraic Expression Reserve (analogous to program mode) I could write the expression twice, once with "+" and once with "-". Pressing the "Comp" key, it would prompt for variables A, B, and C and then return both roots, one at a time. If the roots were complex, it would error out.
-- Robert Riches spamtrap42@jacob21819.net
As this comp.sys.raspberry-pi,
pi@raspberrypi:~ $ wolfram Wolfram Language (Raspberry Pi Pilot Release) Copyright 1988-2016 Wolfram Research Information & help: wolfram.com/raspi
In[1]:= Solve[a x^2 + b x + c == 0, x] 2 2 -b - Sqrt[b - 4 a c] -b + Sqrt[b - 4 a c] Out[1]= {{x -> ---------------------}, {x -> ---------------------}} 2 a 2 a
...
Good catch. And looking in the history, I actually did run it on these parameters, but either did not check the results, or overlooked the "-". Lesson: Better have an automated check of the result, even if you are using an algorithm that should be correct; there can be a bug in the transcription (as happened here) or in the published version.
Here's a corrected version of the code, plus a check:
: compute-q { f: a f: b/2 f: c -- q } b/2 b/2 f* a c f* f- fsqrt b/2 f0>= if fnegate then \ avoids cancelation by the F+ below b/2 f- ;
: quadratic { f: a f: b f: c -- x1 x2 } a b f2/ c compute-q { f: q } q a f/ c q f/ ;
: check { f: a f: b f: c -- } \ should print two 0s, or something close to 0 a b c quadratic 2 0 do { f: x } a x f* x f* b x f* f+ c f+ f. loop ;
- anton
-- M. Anton Ertl http://www.complang.tuwien.ac.at/anton/home.html comp.lang.forth FAQs: http://www.complang.tuwien.ac.at/forth/faq/toc.html
It is unclear from the above as to whether you speak for, or against, the motion that programming in Forth is programming with all the difficulties encountered by human beings when programming in assembly language.
Collapse of stout party?
Or pi@raspberrypi:~ $ maxima
Maxima 5.34.1
You'll probably have to install maxima. As a plus for me, w/maxima I have the same thing on my pi, my desktop and my phone.
Matematicsa's notation feels awkward to me, but it's been a while. Is the capital S really required for Solve? Not solve?
And for a bit of math (Hey, the pi is nominally an educational system), writing it as
-b sqrt(b^2-4ac)
--- +/- ------------- 2a 2a
You have
-b/2a is the axis of symmetry & sqrt(b^2-4ac)/2a is the distance to the roots.
Ron
I would, when Mathematica comes pre-installed.
That's undoubtedly an advantage.
Yes, all built-in and library functions are word-capitalised ("PascalCase"). I'm OK with that. However, I still don't like the square brackets. What seemed awkward to me in your example is the implied equation to zero (might be handy actually) and no indication of which variable to solve for (but obvious in this case with only x).
Programming in Forth has the following advantages over programming in assembly language:
Do you have any other difficulties in mind?
- anton
-- M. Anton Ertl http://www.complang.tuwien.ac.at/anton/home.html comp.lang.forth FAQs: http://www.complang.tuwien.ac.at/forth/faq/toc.html
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.