16-bit Micro Experimenter Board

Get help with your Nuts & Volts projects or Kits purchased from Nuts & Volts here.
denkiguy
Posts: 14
Joined: Tue Oct 27, 2009 8:41 pm
Contact:

16-bit Micro Experimenter Board

Post by denkiguy »

Is anyone else playing wth the 16-bit Micro Experimenter board from the December 2009 of N&V? I ordered one the same day my magazine arrived in the mail. The board went together quite easily and worked the first time no problem.

Looking at the kit documentation (schematic, block diagram and board silk screen), it kind of implies that the LCD is backlit. Although the LCD on my EXp was displaying text and in fact was readable in even low light, I spent a lot of time trying to figure out how to turn on the backlight. To make a long story short, the LCD included in the kit doesn't have a backlight (and really doesn't need one.)

The cool thing about this EXp board is that the possibilities are endless. I plan to build the web server next. What are you working on?
denkiguy
Posts: 14
Joined: Tue Oct 27, 2009 8:41 pm
Contact:

Re: 16-bit Micro Experimenter Board

Post by denkiguy »

You mean to tell me that nobody bought the 16-bit Micro Experimenter board except me? I finally got the Web Server demo running. There are a couple tricks to get it working but overall it is super simple.

The first thing you will need is an Olimex Ethernet Interface board, model ENC28J60-H. These can be ordered from SparkFun Electronics: http://www.sparkfun.com/commerce/produc ... cts_id=765. The Olimex board is wired according to the demo instructions found on the Kiba Corp web site: http://www.kibacorp.com/web%20experiment.html.

If you have any trouble getting the web server to work, here are a couple "tricks" which might help:

1. If the LCD does not come up immediately, you may need to manually select the configuration bits and re-load the hex file. In particular, be sure the Oscillator is set for "Fast RC Oscillator with PLL module".

2. If the LCD comes up but the LED doesn't flash regularly but rather, the LED comes on after about 15 seconds, stays on for awhile and then turns off. In this case, place a pull-up resistor (the exact value is not critical, I used 1.5 K) between pin 1 of the expansion interface and 3.3 Volts.

Remember, the IP address used in this demo code is 192.168.1.201. I set up the second NIC in my PC to support the 192.168.1.x subnet.
mthornton
Posts: 16
Joined: Tue Jul 21, 2009 8:07 pm
Contact:

Re: 16-bit Micro Experimenter Board

Post by mthornton »

I bought one & had it quickly together & it runs the demo firmware no-prob.
Got the C30 compiler installed & working, which was a snap since I have been using the C18 compiler for pic18 chips for quite a while.

"Hello World" (blinkng LED) code works with MPLAB SIM, but won't run on the actual 24F micro. A quick check of pin-12 tells me the internal osc isn't running.
Since I have other projects on the go, I have put this board on the on-hold drawer for now.

I would appreciate it greatly if you would would help me get past this annoying yet humbling little impass.

M

my blink.c code
=================================
#include "p24fj64ga002.h"

//config
_CONFIG2(0xF9C7); //demo default
_CONFIG1(0x3F5F); //demo default

int main(void)
{

asm ("nop"); //for debugger

//Set up Clock
OSCCON = 0x11C0; //select INTERNAL RC, Post Scale PPL
TRISB = 0b1111111111111011; //pin RB2 as output, rest inputs
AD1PCFG = 0xffff; //portB all digital

//OSCCON = 0x1100; OSCTUN = 0x0012; //SET FRC at 8 Mhz
//PLLFBD = 0x0006; //PLL = 8, bring FOSC to 16 MHz
//CLKDIV = 0x0000; //do not divide

while(1)
{
LATBbits.LATB2 = 0; //RB2 = 1
LATBbits.LATB2 = 1; //RB2 = 0
}
}
SETEC_Astronomy
Posts: 582
Joined: Tue May 09, 2006 12:44 am
Contact:

Re: 16-bit Micro Experimenter Board

Post by SETEC_Astronomy »

mthornton my guess is that it's probably working but the LED is blinking much, much faster than you can see.
denkiguy
Posts: 14
Joined: Tue Oct 27, 2009 8:41 pm
Contact:

Re: 16-bit Micro Experimenter Board

Post by denkiguy »

I didn't try to build your code sample but as SETEC_Astronomy mentions, it looks like your LED will be flashing on/off at millions a time a second. In this case, the LED should look like it is simply lit. If you have an oscilloscope you can confirm this by probing pin 1 on the expansion interface board (which connects to RB2).

There is a very easy to use delay macro in the Microchip C30 compiler that makes adding delays easy. For the macro to work, you need to define instruction frequency (FCY) which will be 16 million for FRC = 8, PLL = 0, no clock division. Add the following to the top of your program:

#define FCY 16000000UL
#include <libpic30.h>

You can now use the millisecond and microsecond delay macros. Note that the macros have two underscore characters preceding the word delay.

extern void __delay_ms(unsigned long);
extern void __delay_us(unsigned long);

These macros are defined in libpic30.h which can be found at:

...\MPLAB C30\support\generic\h\libpic30.h

So, to generate a half second delay, use:

__delay_ms(500);


I hopes this helps.
mthornton
Posts: 16
Joined: Tue Jul 21, 2009 8:07 pm
Contact:

Re: 16-bit Micro Experimenter Board

Post by mthornton »

I was using a scope of course.
zip is zip

M
denkiguy
Posts: 14
Joined: Tue Oct 27, 2009 8:41 pm
Contact:

Re: 16-bit Micro Experimenter Board

Post by denkiguy »

M,

I built your blink.c code (with minor changes) and it ran just fine. I moved the LED to RB13 (already had an LED connected there) and added in the delays as I described. Here is the exact code that I built:

#include "p24fj64ga002.h"
#define FCY 16000000UL
#include <libpic30.h>

//config
_CONFIG2(0xF9C7); //demo default
_CONFIG1(0x3F5F); //demo default

int main(void)
{

asm ("nop"); //for debugger

//Set up Clock

OSCCON = 0x11C0; //select INTERNAL RC, Post Scale PPL
TRISB = 0b1101111111111111; //pin RB2 as output, rest inputs
AD1PCFG = 0xffff; //portB all digital

//OSCCON = 0x1100; OSCTUN = 0x0012; //SET FRC at 8 Mhz
//PLLFBD = 0x0006; //PLL = 8, bring FOSC to 16 MHz
//CLKDIV = 0x0000; //do not divide

while(1)
{
LATBbits.LATB13 = 0; //RB13 = 1
__delay_ms(500);
LATBbits.LATB13 = 1; //RB13 = 0
__delay_ms(500);
}
}


Rember that some programmers (like the PICKIT2 that I am using) will hold the /MCLR line low so you need to manually release this line (press the little rising edge symbol in the control bar) or simply remove the programmer.
mthornton
Posts: 16
Joined: Tue Jul 21, 2009 8:07 pm
Contact:

Re: 16-bit Micro Experimenter Board

Post by mthornton »

Rember that some programmers (like the PICKIT2 that I am using) will hold the /MCLR line low so you need to manually release this line (press the little rising edge symbol in the control bar) or simply remove the programmer.
I think you were right, and the problem is to do with the direct control of the picKit2 by MPLAB. When I load and run the code via the picKit2 client (completely separate from MPLAB), it ran fine. Looks like MPLab (control of picKit2) settings have gotten messed up a bit with the installation of the C30 compiler, because the picKit2 debugger also quit working for all chip families, P16 and P18 (from within MPLAB).

Thanks all for help.
M
TomK
Posts: 3
Joined: Thu Feb 11, 2010 9:59 am
Contact:

Re: 16-bit Micro Experimenter Board

Post by TomK »

For those interested there a series of new experiments and lesson plans for new users posted at

http://www.kibacorp.com/begin.html


regards,
TomK
TomK
Posts: 3
Joined: Thu Feb 11, 2010 9:59 am
Contact:

Re: 16-bit Micro Experimenter Board

Post by TomK »

FYI --for those interested in even higher performance for their 16 Bit Experimenter, Microchip released a new pin-to-pin compatible part to the existing PIC24F64GA002 it is the dsPIC33FJ128GP802 I/SP. This part is available from Mouser. The new part has all the capabilities of the PIC24F plus DSP capabilites, DAC, DMA and twice the FLASH (128K) and twice the RAM (16K) . It is also can run at 40MIPS top speed versus 16MIPS

Kibacorp posted a demo of it using the 16 bit Experimenter card. In the demo The dsPIC33 was configured for 16MIPS clock to make the existing demo work.

http://www.kibacorp.com/PIC33.html


Tom K.
essanvee
Posts: 2
Joined: Fri Feb 26, 2010 7:30 am
Contact:

Re: 16-bit Micro Experimenter Board

Post by essanvee »

Hello fellas, I am a mechanical engineer in the diesel engine industry, but I find microcontrollers to be absolutely fascinating and I think it is important to expand my skill set with knowledge in such ubiquitous technology. There are a lot of times in which a small IC circuit or microcontroller with a small program would solve an otherwise difficult problem for us.

I happened upon Nuts and Volts about 3 months ago at the local library... when I saw the 16-bit experimenter, I decided I would jump in with both feet. To say I am a noob at electronics is an understatement - I can effectively use a DVOM most of the time. I had the standard electronic theory class at Penn State - and generally know how to apply Ohms Law and some others - that is about it. But because the magazine has a very homegrown and helpful feel to it, I felt I could probably get a hand if I came humble and ready to try stuff and learn. Also, I think the technology has caught up to where the tools have been simplified to the point where I do not have to write and design every last bit to get something to run/compile/debug/etc. And I am still blown away that I can get a chip of this power for around $3.

If there happen to be any readers/members in the Detroit area, I would love to get together and learn some basics so I don't have to struggle so much. I am having trouble getting hooked up to the board itself, but am not asking questions as of yet because I want to read though the help info on Microchip's site and get it to work myself - but I am sure there will be some things were help menus aren't available and so I thought I would introduce myself and try and meet a few people.

Best regards, Matt
denkiguy
Posts: 14
Joined: Tue Oct 27, 2009 8:41 pm
Contact:

Re: 16-bit Micro Experimenter Board

Post by denkiguy »

Matt, Come on in, the water is fine.

If you are looking to get your feet wet in the world of microcontroller, this is a good place to start. I am happy to help but will have to do so on-line as I live in the Seattle area.

If you are starting out from scratch, may I suggest the book called "Beginner's Guide to Embedded C Programming" by Chuck Hellebuyck, available from the Nuts and Volts store or Amazon. This book walks you through, step by step, the process of installing the development environment, building a project (program), downloading the program to the controller and running it. The hardware/programmer used in this book is the PICkit 2 Starter Kit available from various sources including Jameco, Mouser and Microchip Direct. The Nuts and Volts store sells a bundle which includes both the PICkit 2 starter kit and the Chuck Hellebuyck books.

The PICkit 2 starter kit and the Hellebuyck books feature the 8 bit PIC processor, specifically the PIC16F690. The 16-bit Micro Experimenter hardware is designed around the 28 pin, 16-bit PIC processors. There are some distinct advantages to the 16 bit PIC, especially if you plan to program in the C language. In my mind, the only disadvantage of starting out on the 16-bit PICs is the lack of introductory level books/resources.

As for myself, I do not use the 8-bit PICs much anymore. For a few pennies more, you can use a faster 16 bit PIC with 16 bit math, 16 bit timers, and more onboard ROM (FLASH) and RAM. Fortunately, the Microchip IDE and PICkit 2 programmer/debugger can be used on both the 8-bit and 16-bit pics.
dana7
Posts: 1
Joined: Sun Feb 28, 2010 6:09 am
Contact:

Using SPI with the serial EEPROM

Post by dana7 »

I had a little trouble getting the Serial EEPROM working. Some work has to be done to remap the pins to the SPI1 device. I did not see a sample in the demo code, so I hit the databook and came up with the following: Hope it saves someone some time:

void setPins_forSPI1(void)
{
/*
CALLER MUST STILL SET PINS TO DIGITAL I/O
Example:
"AD1PCFG=0xffff;//convert all analog pins to digital I/O"
should appear somewhere in the callers code.
___________________________
Remap pins: Rp7 (pin 16) for SDI1 (SPI 1 input data)
Rp8 (pin 17) for SCK1OUT (SPI 1 clock output)
Rp9 (pin 18) for SDO1 (SPI 1 output data)
*/
// Unlock Pins Configuration
asm volatile ( " MOV #OSCCON,w1 \n"
"MOV #0x46, w2 \n"
"MOV #0x57, w3 \n"
"MOV.b w2,[w1] \n"
"MOV.b w3,[w1] \n"
"BCLR OSCCON,#6" );

//Assign SDI1 to pin Rp9
RPINR20bits.SDI1R=9;

// Assign SCK1OUT to Rp8
RPOR4bits.RP8R=8;

//Assign SDO1 to Rp7
RPOR3bits.RP7R=7;

//Lock Pin Configuration
asm volatile ( "MOV #OSCCON,w1 \n"
"MOV #0x46, w2 \n"
"MOV #0x57, w3 \n"
"MOV.b w2,[w1] \n"
"MOV.b w3,[w1] \n"
"BSET OSCCON,#6" );
}//setPins

Admittedly, It looks a whole lot better the way I typed it than it does here! All my text formatting seems to be gone.

Cheers,
Dana
TomK
Posts: 3
Joined: Thu Feb 11, 2010 9:59 am
Contact:

Re: 16-bit Micro Experimenter Board

Post by TomK »

Try this --it should appear first in your main code
{ //*********************this code programs RP7, RP8, RP9 to be SPI #2 to 25LC256 EEPROM
__builtin_write_OSCCONL(OSCCON & 0xbf) ; //clear bit 6. unlock
//input
RPINR22bits.SDI2R = 9; // make Pin RP9 SDI2
//output

RPOR3bits.RP7R = 10; //SD02
RPOR4bits.RP8R = 11; // SCK2OUT

__builtin_write_OSCCONL(OSCCON | 0x40) ; //set bit 6 lock programming
//************************************************ end of RP7,Rp8,Rp9 programming

There is also an eeprom demo from last month's N+V article.

TomK.
essanvee
Posts: 2
Joined: Fri Feb 26, 2010 7:30 am
Contact:

Re: 16-bit Micro Experimenter Board

Post by essanvee »

Denkiguy,

Thanks for the note... I was using a MPLAB ICD 2 that a friend lent me... but it didn't seem to want to recognized the board. I screwed with it for more than an hour and then decided I would buy the Pickit 2 and following the recipe. I see the great advantages to 16-bit, but actually decided to buy the Smiley AVR kit while getting the Pickit 2 so I could go through the 15 workshop exercises and form a good base.

One question I have... how to I determine what maximum frequency I can get a PWM off the 16-bit board to run? In the future, I am going to be designing a circuit to fire injector solenoids using a crank and/or camshaft reference, but on the outside, it will need to have 1-degree resolution at 8,000 rpm... which is 24 kHz on the top side... though 4 kHz will be enough to get it running. Anyways, is there a formula, or it is defined by the nature of the design of the chip?

Also, I read the article about the optical isolators and they appear to be just the thing for driving large voltage/current coils required by engine components.

Cheers, Matt :D
Post Reply

Who is online

Users browsing this forum: No registered users and 5 guests