one problem with the clone boards was not the arduino but the serial to usb chip that was often used – these were designed by FDTI (based in Scotland) but many knockoff clones appeared at much lower price – these worked per spec except in one relatively unimportant way but FDTI exploited this to install a driver under Windows that would brick any unauthorised clone – caused a great rumpus (+ threat of legal proceedings) in late 2014 so much so that Microsoft forced FDTI to withdraw the driver noting that FTDI removed two driver versions from Windows Update. Our engineering team is engaging with FTDI to prevent these problems with their future driver updates via Windows Update.
Seriously, it is really good to see and hear about the ways in which others are incorporating microcontrollers and electronics into hobby engineering projects.
Interested to hear about this Micromite and got distracted for an hour or so trying to find decent info about it The documentation and websites almost go out of their way not to give pinouts etc in an accessible manner.. Looks like the interpreter uses so much memory because it is probably written in C.
I've used a number of microcontrollers and it is nice to see one that doesn't need an IDE on another computer.
I've used a number of microcontrollers and it is nice to see one that doesn't need an IDE on another computer.
But isn't that one of the (few?!) advantages of an interpreted language? There were compiled versions of Basic (eg Turbobasic) but they were the exception rather than the rule IIRC. One big issue with interpreted languages being that if you supply an illegal input or the interpreter encounters a syntax error, they have to bomb out. Bit of a problem with real time systems.
Well exactly. That's why I said it was nice to find a self contained unit. I can't run these IDEs on my locked down work laptop so have to wind up the old Windows 2000 machine. Actually most of the controllers with a 'user friendly' IDE, including the Arduino, are not full compliers but producing an intermediate code that is run by an interpreter in the chip – that's why the chips have to be preprogrammed.
Michael, Thanks but I had found that eventually and some details of the Micromite 64 which I think I will try out but the various boards don't have clear details on the website selling them It is a bit disorganised. But with the cheapest built and programmed board at under 15 quid it is not too painful to try out.
I have uno's that are genuine boards and copies but they all work the same,
You're lucky in that case. Most of the Chinese copies won't work with the standard Arduino USB driver for programming. (There is a driver, that works, available but you have to know and dig it up).
Thanks for the heads up regarding drivers. Bought my first Arduino Uno (clone) from Amazon. Wouldn't work on Windows 10 reporting that no driver loaded. Tried Manual driver install from the Arduino download but no joy. Remembered this thread and discovered that my clone has a CH340G usb chip and not the FTDI chip. Downloaded the driver **HERE** and all working fine even managed to install the sketch for the rotary table which appears to function. All I have to do now is fit all the bits together in a box!
Actually most of the controllers with a 'user friendly' IDE, including the Arduino, are not full compliers but producing an intermediate code that is run by an interpreter in the chip – that's why the chips have to be preprogrammed.
I hadn't heard that and can't see any reference to any interpreted element. I understood that Arduino code is a simplified version of C++ that is compiled into machine code and uploaded.
There are loads of references out there and although Wikipedia is hardly the ultimate arbiter, it sates that "after compiling and linking with the GNU toolchain….the Arduino IDE employs the program avrdude to convert the executable code into a text file in hexadecimal coding that is loaded into the Arduino board by a loader program in the board's firmware." Presumably this allows the bootloader to run the code after reset? Can you point us to something that explains what you mean?
Actually most of the controllers with a 'user friendly' IDE, including the Arduino, are not full compliers but producing an intermediate code that is run by an interpreter in the chip – that's why the chips have to be preprogrammed.
…
Thanks to Bazyle for launching me into another useful learning experience!
I didn't believe the suggestion that the Arduino has an interpreter in the chip and tried to confirm that's wrong. Loads of stuff on the web implies that Bazyle is mistaken but I couldn't find anything that confirmed it positively. I ended up doing forensics on one of my own programs.
Normally the Arduino IDE (Integrated Development Environment) doesn't save the compiled file uploaded into the Microcontroller. It can be ordered to save it from the Sketch Menu with 'Export compiled binary'. Doing this produces two hex files; they appear to be identical except that one of them includes bootloader code. These files can be analysed.
A hex file can be disassembled a command line utility called avr-objdump. Although this was downloaded with the IDE it is not installed (at least on linux), so using it involves typing in full pathnames, or copying everything into the same directory.
Then this magic incantation disassembles the binary file, ie converts machine code back into assembly language. My example program is in monitor.ino.standard.hex, and objdump writes the decode into a new text file called hum.s:
Inside hum.s is the evidence, and it looks very much like AVR assembly language to me, not interpreter tokens:
That's the case for the defence m'lud. I suspect Bazyle has misremembered how this particular microcontroller works, he's quite right that others interpret.
Normally using an Arduino is much easier than this, but it's useful to know that the IDE comes with a full set of advanced software tools, hidden away though they are.
Dave
After posting, discovered that muzzer got in first!
These have a 'Harvard' architecture with separate program and data memory spaces (EEPROM and RAM), although the distinction has become academic as EEPROM is unreliable and awkward to program and newer instructions let you directly read and write to the much more reliable and long-lived (in terms of r/w cycles) flash.
You can write programs for AVR in any language that has a suitable compiler to AVR machine code, and the Arduino standard is a version of C used through the 'Sketch' program.
Most AVR users use GCC (GNU C Compiler) together with WINAVR.
Studio 6 the AVR development environment can supporet multiple languages ( ) although it only has programming support for 18 and 32-bit AVR GCC, AVR assembler and ARM built in (i.e. you need to add a compiler).
For my sins I write most of my code in AVR assembler because I'm a hair-shirted 8-bit obsessive.
Arduinos are really only AVRs with a pre-programmed bootloader on a dedicated pin-out board. they can be programmed as ordinary AVRs OR an ordinary AVR can use the Arduiino bootloader and have greater flexibility of how you use the pins.
You CAN have an interpreter running on AVR, I know because I have written a version of BBC BASIC that runs on an AVR although that link is just about the display driver.
As I've mentioned its well worth looking at Atmel's website and AVRfreaks website if you want to really take these chips to the limit whether or not you use arduino boards.
Now that combination is impressive! How on earth do you find the time?
The method shown in Les Jones link didn't work for me on linux with version 1.6.8. It's a pity because you get to see the 'C' being converted to Assembly and the machine code as well. As far as I can tell, Arduino 1.6.8 on linux doesn't write any temporary files, or if it does they get deleted. Might be different on Windows, I shall fire it up and have a look later.
The Arduino AVR creates temporary files on all versions (I use the MAC one), but normally deletes them once it has finished with them.
There is a an entry you can add to preferences.txt that will prevent it from deleting all of these temporary files, along with the hex files.
export.delete_target_folder=false
You only need pre-programmed chips (bootloader pre-installed) if you are using the bootloader to help load your program or you want to upload via the USB connection on the board.
If you want to save the space used by the bootloader and/or program the chip directly, or buy blank chips and program them on your breadboard, you can do this via the ICSP connection and a suitable programmer like a USBasp, AVRISP or USBtinyISP, any of which can be bought for less than £3.00, some for less than £1.00.
If you do put a bootloader on, you can then upload programs via the serial pins by resetting the chip at the right point during the compile, such that the bootloader is looking for new code as you are attempting to talk to it from the IDE, if you time it wrong, the bootloader simply loads whatever code is already programmed on the chip (if any).
The first time you program a brand new chip, it may need some different fuse settings as it may be set to the factory default clock speed of 1MHz, which may not be supported by all programmers (some have an additional jumper to allow use at that clock speed).
Thanks Zebethyal, that preference keeps all my build files, which are stored in /tmp
The only problem now is that the elf doesn't have any debug info in it, so the C source is missing from objdump's output. I'm wondering if gcc flags can be set as a preference. Hmmm.
More seriously, I googled 'pic microcontroller rotary table' – still some false positives as PIC means short for picture, 14,000 results. Substituting AVR gave over 45,000 and ardiuino well over 100,000.
the magazine has no bias, the bias is in the numbers of people using different types of micro for workshop projects.
Quite happy to feature some PC projects, but I would worry about 8051, 6502 or even Cray X-1 as minority interests
Neil how about a 4040 project – I still have one (probably never used) + support chips – not 100% sure they have survived the last 35yrs tho as bought as spare for a student project I was supervising and forgotten about for years.
I already had an Arduino uno and thought I would by the LCD shield to convince myself it works before getting the motor and driver. I am not up to speed with the programming.
I have uploaded the sketch and fitted the shield but it's not working quite right, unless this is because the other parts are not installed.
On power up I get the version number displayed and then SELECT MODE and MODE = STEP which is correct.
When I press the SELECT button nothing happens. Pressing LEFT, UP or DOWN scrolls between STEP,TEMP,RUN and JOG. RIGHT does not do anything.
Is it possible the LCD shield is faulty?
I would appreciate any suggestions anyone can offer.
I don't have an arduino uno and LCD + switch sheild but
pre empting buying them to experiment with I have found conflicting notes about the LCD sheild
it seems that some boards you can only use D10 to switch the display LED backlight on & off
others you can use PWM to contol the brightness
this is what I have so far
John
PS
routine to read keys
int read_LCD_button() // routine to read the LCD's buttons
{
int key_in;
key_in = analogRead(0); // read ADC
// average values for my board were: 0, 144, 324, 505, 742
// add approx 100 to those values to set range
if (key_in > 1000) return NO_KEY;
if (key_in < 50) return RIGHT_KEY;
if (key_in < 250) return UP_KEY;
if (key_in < 450) return DOWN_KEY;
if (key_in < 650) return LEFT_KEY;
if (key_in < 850) return SELECT_KEY;
}