Author Topic: Where to start with mblab and micro-controllers  (Read 1586 times)

0 Members and 1 Guest are viewing this topic.

Offline rex1232Topic starter

  • Contributor
  • Posts: 13
  • Country: dk
Where to start with mblab and micro-controllers
« on: October 12, 2017, 11:26:18 am »
Hello everybody

I am studying electronics and I am working as an apprentice.
My boss has given me a pretty hefty development board which I am supposed to create a signal/message with which I can then via a uart stick send to a pc.

I am reading about C programming atm but where do you guys recommend a beginner like me to find the info and everything I need.
(I already have an MPLAB REAL ICE DEBUGGER)

thank you in advance  :)
« Last Edit: October 12, 2017, 11:31:30 am by rex1232 »
 

Offline Ian.M

  • Super Contributor
  • ***
  • Posts: 12860
Re: Where to start with mblab and micro-controllers
« Reply #1 on: October 12, 2017, 11:45:29 am »
That depends - what model development board are you using and which Microchip MCU is fitted to it?    Most of what you need will probably be on the Microchip website, but its a very large site . . . .
 

Online jpanhalt

  • Super Contributor
  • ***
  • Posts: 3478
  • Country: us
Re: Where to start with mblab and micro-controllers
« Reply #2 on: October 12, 2017, 11:56:25 am »
I would ask your boss what language to use.   A company or research group will probably want to standardize on that.

I had some experience with Basic in the 1980's.   When I started micros (about 10 years ago), I started with MPASM, as the learning curve for that seemed much less steep than for C, and have stayed with it.   Today, your boss may simply tell you that is not an option.
 

Offline rex1232Topic starter

  • Contributor
  • Posts: 13
  • Country: dk
Re: Where to start with mblab and micro-controllers
« Reply #3 on: October 12, 2017, 12:15:28 pm »
Its a PIC16/32, Explorer 16/32 board

I have a PIC24FJ1024GB610 100-pin
I am programming in C.
 

Offline Ian.M

  • Super Contributor
  • ***
  • Posts: 12860
Re: Where to start with mblab and micro-controllers
« Reply #4 on: October 12, 2017, 12:57:36 pm »
OK, so you'll need MPLAB X and Microchip XC16 installed.  Both are easy to find on the Microchip website, and are linked from the Explorer 16/32 page.

Personally, I'd start with the supplied demo code. Its got a folder for the PIC24FJ1024GB610 in the zip file, and if you unpack that to your MPLAB X projects folder it should work immediately 'fresh out of the box', using the PKOB onboard programmer/debugger on the Explorer 16/32.  Your Real ICE may well offer more debugging features and faster debugging, but its advisable to keep it as simple as possibly untill you have the board up and running with your own code.

Once you've got that going, you can hook up an extra USB cable to the micro-B port of the on-board MCP2221A USB to UART interface, and populate J37 and J38 to connect it to the PIM and start developing your serial comms code.  You will need a terminal program on your PC - if you don't already have a good one, https://realterm.sourceforge.io/ is strongly recommended.

Pay particular attention to Rstofer's comments below - he's given you a roadmap for getting the UART going.
« Last Edit: October 12, 2017, 01:06:19 pm by Ian.M »
 
The following users thanked this post: rex1232

Offline rstofer

  • Super Contributor
  • ***
  • Posts: 9890
  • Country: us
Re: Where to start with mblab and micro-controllers
« Reply #5 on: October 12, 2017, 12:57:59 pm »
First you download the datasheet and skim through it.
You will need to use one of the UARTs so pay particular attention to that peripheral.
Start at page 255 here:

http://ww1.microchip.com/downloads/en/DeviceDoc/30010074e.pdf

Then you read the "Family Reference Manual - UART" document here:

http://ww1.microchip.com/downloads/en/DeviceDoc/en026583.pdf

There's sample setup code on page 23 but it is mostly useless because it spends a lot of time on interrupts and you are unlikely to need those for your project.  Only 4 lines are really required (I think).

There are similar peripheral specific documents for the other components.  Eventually, you will need to have them all.

There is some sample code here:

http://www.microchip.com/forums/m751916.aspx

Following the discussion, DO NOT enable interrupts until you get far enough along to implement interrupt handlers.  You don't need them at this point.

You may find a lot of other examples via Google.

 
The following users thanked this post: rex1232

Offline rex1232Topic starter

  • Contributor
  • Posts: 13
  • Country: dk
Re: Where to start with mblab and micro-controllers
« Reply #6 on: October 12, 2017, 01:12:38 pm »
thank you very much I will get right to it  :)
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf