What is NanoCore12?NanoCore12 is a family of DIP format microcontroller modules which can be programmed in assembler, BASIC, or C (or any other programming language available for Freescale’s HC12 or HCS12 microcontrollers).
What sizes does NanoCore12 come in?NanoCore12 is offered in 24-pin, 32-pin, and 40-pin wide DIP module formats (0.6 inch wide).
How do I power NanoCore12?There are two ways: to use the on-board 5V regulator, connect a DC supply of 5 to 15 Volts between the VIN (+) and VSS (-) pins. Otherwise, connect a regulated 3V or 5V supply directly between the VCC (+) and VSS (-) pins and leave the VIN pin unconnected. It is important to realize that any voltages applied to other pins should not exceed the supply voltage you are using. For example, if you are using a 3V supply, the logic levels you apply to the port pins should be 3V logic, and any signals you apply to the analog input pins should be between 0 and +3V. Overvoltage (or
negative voltage) applied to any pin can damage that pin or the entire microcontroller.
How much current does NanoCore12 draw?NanoCore12 consumes approximately 15 mA in running mode, but can be put into a low-power (sleep) mode via software, where the current drops to about 20 uA (not including any current drawn by circuitry on the I/O pins).
Does NanoCore12 lose its program when I disconnect the battery or power supply?No, your code is stored inside flash memory on-board NanoCore12. Flash provides non-volatile storage; it retains memory even without power. The flash inside NanoCore12 is guaranteed to function properly for at least 10 years and for 1,000,000 write cycles, over worst-case temperature conditions (even longer, under moderate operating conditions).
Is NanoCore12 sensitive to static electricity?While many electronic devices, including NanoCore12, can be damaged by static electricity, NanoCore12 is generally more tolerant of static. We do, however, recommend taking all the usual precautions when handling NanoCore12 in static prone environments.
Can NanoCore12 be embedded into my product for volume manufacturing?Yes. Technological Arts offers NanoCore12 modules in volume at a discounted price for economical integration into your products. Contact us for your specific needs.
What items do I need to get started with NanoCore12?The items you need are:
1. programming software to develop your application (free or commercial, depending on your budget and needs)
2. Docking Module or School Board with serial cable (or just use a solderless breadboard and our breadboard-ready serial cable)
3. NanoCore12 module of your choice
4. loader program to load your application into NanoCore12's memory (freeware or part of the development package)
5. a suitable DC power supply
6. manual (free PDF download from website)
If you are new to NanoCore12, it is best to purchase one of the NanoCore12 bundles, such as Kit1, Kit2, or a QuickStart Package. These bundles include various combinations of the items listed above.
What kind of microcontroller chip is used in NanoCore12?NanoCore12 uses a 9S12C microcontroller, a member of Freescale’s high-performance CMOS “HCS12” family of 16-bit microcontrollers.
What kind of environment can NanoCore12 operate in?NanoCore12 modules will work over a temperature range of -20° to +70° C, with up to 70% non-condensing humidity. While the modules may continue to function outside these ranges, it is not guaranteed nor recommended by Technological Arts. Additionally, it is best to keep NanoCore12 modules away from, or shielded from, any nearby RF interference as this may impact the behaviour of the I/O functions.
How many I/O pins does NanoCore12 have?Depending on the module size, NanoCore12 has from 16 multi-purpose I/O pins plus serial port pins RX and TX.
Here is a summary, by module size:
NanoCore12 (24-pin): 16 I/O pins
NanoCore12DX (32-pin): 24 I/O pins
NanoCore12MAX (40-pin): 29 I/O pins (+ 2 CAN pins)
What can I use the I/O pins for?NanoCore12’s I/O pins are perfectly suited to digital input and output with TTL/CMOS level signals. In addition to basic I/O, all of the pins have alternate functions related to a powerful set of on-chip hardware subsystems. These subsystems include serial communication interface (SCI) which is essentially a UART, used by the RS232 Comport function; serial peripheral interface (SPI) on the 32-pin and 40-pin versions, a 16-bit timer/counter system which supports Input Capture and Output Compare functions (very useful for generating and measuring pulses and pulse trains) , eight-channel 10-bit Analog-to-Digital Converter, Controller Area Network (CAN), multi-channel Pulse-Width Modulation (PWM), and a Real-Time Interrupt (RTI) capability.
Can the I/O pins be used to control relays, solenoids, motors, and other similar devices?Yes, however, due to the demanding current and voltage requirements of these types of components, suitable driver circuitry will be required in order to properly isolate the I/O pins from harmful effects. In many cases, a simple switching transistor will suffice.
Can I control LEDs with the I/O pins?Yes. Simply use a resistor (nominally, 1K) in series with the LED to limit the current draw through the I/O pin.
How much current can the I/O pins handle?Each I/O pin is capable of sourcing or sinking a maximum of 25 mA; however, the total across all I/O pins should not exceed 80 mA source or sink at any given time.
Can NanoCore12 generate analog voltages?Generating an analog output is very simple, using a PWM waveform in conjunction with a resistor and capacitor. The result will be the a voltage between logic low and logic high, proportional to the duty cycle. Alternatively, a DAC chip can be used, via the SPI port (see below), or by implementing the popular IIC interface in software.
What can I use the SPI pins for?The Serial Peripheral Interface (SPI- pronounced "spy") opens up a whole realm of possibilities for I/O expansion. Some possibilities are: multi-channel analog-to-digital conversion, non-volatile data storage (serial EEPROM, serial Flash), clock/calendar functions, LCD interface, and a virtually unlimited number of additional input and output lines. SPI is also compatible with the popular SD card format, so it’s possible to add SD card storage to your application. SD cards operate at 3V, however, so you’ll have to run NanoCore12 at 3V or use level-translation circuitry. Also, note that SPI is only available on the 32-pin and 40-pin versions).
How fast does NanoCore12 execute code?The MCU in NanoCore12 has a bus speed of 24Mhz (when the PLL is enabled). This translates to an instruction cycle time of approximately 42ns. Most CPU12 instructions execute in 2 to 9 cycles, with an average of around 4 cycles (167ns). This means NanoCore12 can execute code at an average speed of about 6,000,000 instructions per second (6 MIPS). The true execution speed depends upon many factors, including the particular set of instructions used and their addressing modes.
How does the reset pin (RESET*) work?The reset pin is internally controlled by NanoCore12’s low-voltage inhibit circuit. It is normally at logic high, which enables NanoCore12 to run its program, and is pulled low when the power supply voltage drops below a lower limit, which safely puts NanoCore12 in a reset state. This pin can be monitored to detect when a reset condition occurs, or, you can pull the line to ground to force a reset (via the reset button on the Docking Module, for example). After the reset pin is allowed to rise back to logic high, NanoCore12 wakes up and starts executing its program from the first line of code (pointed to by the Reset Vector). Do not drive this pin high-- it should be left electrically disconnected (floating) when you want NanoCore12 to run normally.
What is the slide switch for?There is a small Serial Monitor program in a protected memory block on NanoCore12. During programming, the Serial Monitor needs to be put in Active Mode so that the program can be loaded in, via the serial port. This position is labelled LOAD on the Load/Run switch (SW1). During programming, slide the switch to the Load position. After your code has been loaded, slide the switch to the RUN position. Reset the board to cause the MCU to begin executing your program.
How much current can NanoCore12’s on-board regulator provide?The 5-Volt regulator built into NanoCore12 can supply 100 mA of current if powered by a 6 Volt source. The limit is affected by operating temperature, so if the unit is running significantly above room temperature, the maximum current it can supply will be reduced. The amount it can supply will also be reduced if you use a higher input voltage. This is because the regulator drops the voltage to 5 Volts by dissipating the excess voltage as heat. NanoCore12 draws approximately 15 mA in RUN mode, leaving as much as 85 mA for use with other circuitry via the VCC pin and the I/O pins. In reality, however, the available current will be somewhat less. However, the regulator has internal over-current protection, so it will just shut off if it gets too hot, and come back on when it cools down. This can have unusual effects in an application, though, so it is best to keep this limitation in mind.
Can NanoCore12 generate a sine wave?Yes. NanoCore12 can be made to generate a sine wave by means of a continually varying pulse-width on an output pin. By adding an RC circuit to average out the PWM waveform over time, the result is a sine wave. The same technique can be used to generate other types of waveforms as well.
Can NanoCore12 generate a waveform on two pins at once?Yes. NanoCore12 is a multi-tasking device, utilizing a hardware timer system and interrupts to generate waveforms independently, and thus can generate more than one waveform at a time (besides doing other tasks).
Can NanoCore12 generate square waves?Yes, it is very easy to do this using the Output Compare feature of the hardware timer subsystem.
Can NanoCore12 vary the pulse-width of a square wave?The duty cycle of the square wave can easily be varied to produce a PWM waveform. Varying the pulse-width can, for example, control the shaft position of a servo motor, the speed of a DC motor, the effective brightness of a light, or the temperature of a heater. While this can be accomplished via a general-purpose output port by a simple software loop, there is a powerful hardware subsystem that will do it for you without any software overhead. You just set up the desired PWM parameters and the PWM waveform will be automatically generated on the chosen PWM output pin (channel). There are several of these PWM channels on NanoCore12, and each is independently programmable and free-running!
Does NanoCore12 include a real time clock function?Not exactly. However, it does have a real-time interrupt (RTI), which can be used to accurately measure the passage of time. In fact, NanoCore12's RTI rate is programmable to an integer division of the bus speed, so it easy to keep track of time accurately to microsecond resolution, if required. If you need to keep track of absolute time (especially dates and time-of-day) while holding the MCU in a low-power mode, it might be better to interface a clock/calendar chip to NanoCore12. Many are available from various manufacturers (e.g. Dallas-Maxim, Microchip, Philips/NXP, National Semiconductor, Texas Instruments). Those with a serial interface (SPI or IIC) are usually better choices, as they can be implemented with fewer NanoCore12 I/O pins.
Does NanoCore12 have a built-in timer?
Yes, it has a real-time interrupt, (mentioned above) that is programmable in various absolute time increments. This can be used for such applications as task-scheduling, switch debouncing, or elapsed time measurement. A real-time operating system, called FreeRTOS is available online, as are various other examples.
Does NanoCore12 support interrupts?Yes, there are 20 different interrupt sources on NanoCore12! These are all user-enabled, so that an interrupt can be made to occur on such events as:
* an input pin logic-level changes
* the hardware timer overflows
* the hardware free-running counter matches a user-defined value
* a byte has been received via the serial port
There are also two interrupt input pins. XIRQ (PE0) and IRQ (PE1) on the 32-pin and 40-pin versions, which can be used to signal NanoCore12 when some external event has occurred. Additionally, any of the interrupts can be used to trigger a wake-up of NanoCore12 from sleep mode. These are very important advantages that NanoCore12 has over similarly-priced stamp-sized modules.
Questions regarding operation and use:
How do I program NanoCore12?You can write your BASIC, C, or assembler program using any text editor (eg. Notepad or Edit) or Integrated Development Environment (IDE) on a standard IBM compatible PC. After you compile and assemble the code for your application, you simply plug NanoCore12 into a Docking Module (or leave it in your solderless breadboard and use our breadboard-ready serial cable), connect to the computer’s serial port, apply power, slide the switch to LOAD, and press the reset button. To download your program into NanoCore12’s flash memory, use the free Windows uBug12 program or the IDE’s built-in loader (if provided). As soon as the program has been downloaded, slide the switch back to RUN, press the reset button, and NanoCore12 begins executing its new program, starting at the first line of code (pointed to by the Reset Vector).
How does my program get stored in NanoCore12?Your code gets stored in NanoCore12’s flash memory. This memory is non-volatile, meaning it retains its program even without power. Every time power is applied to NanoCore12 or it is reset, it starts running code directly out of flash, starting with the first executable line pointed to by the user Reset Vector (a dedicated memory location where the address of your program’s first line of code gets stored). Source code elements like comments and constant and variable names are not stored in NanoCore12, thus you are free to use as many comments and descriptive symbol names in your code as you like, without worrying about increasing your code size.
How do I erase NanoCore12’s program space?Using the FBULK command in uBug12 will do the trick.
How do I re-program NanoCore12?Simply re-connect it to the computer (via the Docking Module or solderless breadboard serial cable), and run uBug12. Type CON1 to activate the serial port connection, and then type FBULK to erase the memory, followed by FLOAD to load your new code into memory.
How big a program can I store in NanoCore12?NanoCore12 has 32K or 128K bytes of program storage (depending on which version you purchased). Most MCU instructions require from 1 to 3 bytes of storage space. This means you have enough space for about 12,000 instructions on a 32K version, or 48,000 instructions on a 128K version. If you're writing your code in C or BASIC, the number of lines of code you can store will depend on the number of instructions it takes the compiler to implement a line of code. This number will vary greatly, depending on the line of code being compiled.
How much data memory is available?There is 2K or RAM on the 32K versions, and 4K of RAM on the 128K versions. RAM is used to implement global variables and local variables (via the CPU stack).
Can I expand the data memory?If you need to log data or create large arrays of data (e.g. for robotic maze navigation) you can interface serial EEPROMs, or other memory devices via NanoCore12’s I/O pins (e.g. SPI) to gain more data storage area. You will need to include the appropriate code within your program to interface to the particular device you choose. One popular choice these days is SD memory cards, which are very inexpensive. The hardware interface is 3Volts, but it is SPI compatible, making them an attractive choice for large data storage needs (e.g. data logging).
How difficult is it to program NanoCore12?When compared to other programmable microcontrollers, NanoCore12 is perhaps the easiest to use because of its powerful hardware subsystems, the variety of languages supported, and its straightforward method of downloading and debugging. If you have some experience programming in BASIC, C or Pascal, you should find the learning process with NanoCore12 to be a fairly simple one, once you get to know the MCU's hardware features. If you are experienced in assembly language programming, you’ll find it an enjoyable experience. If, however, you have never had any programming experience, you may have to spend some extra time studying the examples and application notes provided to get comfortable with NanoCore12.
Can I program NanoCore12 in Visual BASIC, TurboPascal, or QBASIC?No. These languages produce programs that are meant to be executed on a PC. NanoCore12 is a microcontroller, not a miniature PC. It does not have an operating system, graphical user interface (GUI), hard drive, or a lot of memory.
What is SBASIC?SBASIC is a HC11/HC12-specific form of the BASIC programming language which many people are familiar with. It is a Freeware cross-compiler (for MS-DOS), written by Karl Lunt, and is intended for educational and personal use. It is not permitted to be used for the development of commercial applications. SBASIC has special commands to efficiently control the features of the HCS12 MCU.
Can I embed assembly language routines in my SBASIC or C code?Yes, SBASIC and C are both compilers (not interpreters), and they allow assembly language routines to be included wherever desired. You run the compiler on the completed program to produce assembly language code. Then you assemble it to produce a downloadable file containing s-records.
How do I know how much space my program consumes?A quick estimate can be made by dividing the .s19 filesize by two. But a more accurate way is to look at the listing file generated by the assembler to see what is the last address it put code in. The map file is probably the most accurate way.
How do I debug my programs?There are two kinds of errors arising in programs:
1. Syntax errors (missing or incorrect punctuation and misspelled keywords, for example)
2. Logical errors (faulty logic, where the resulting flow control is not what was desired, for example)
Syntax errors can be corrected by examining the offending line(s) and comparing them with the definitions provided in the assembler or compiler user manual.
Logical errors are sometimes more difficult to find but may be more easily discovered by careful placement of print commands. For example, you can print the current status of specific variables in your program to the serial port as it is executed. Then monitor the serial port using any terminal program.
Can I read out the program which is already stored in NanoCore12?Yes, using uBug12, you can examine the contents of NanoCore12’s memory and registers.
Can my program store sensor values to the on-board EEPROM (ie. datalogging)?No, the flash memory is reserved for your program and any constant data (eg. text messages, conversion factors, etc.). After programming, the flash is protected. To log data values, (eg. sensor values), you should store them in serial EEPROM or serial Flash that you interface to the SPI port.