Where to start with mblab and micro-controllers - Page 1
Forum section: electronics / beginners

author: rex1232
author_rank: Contributor
timestamp: October 12, 2017, 11:26:18 am
content: Hello everybodyI 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

author: Ian.M
author_rank: Super Contributor
timestamp: October 12, 2017, 11:45:29 am
content: 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 . . . .

author: jpanhalt
author_rank: Super Contributor
timestamp: October 12, 2017, 11:56:25 am
content: 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.

author: rex1232
author_rank: Contributor
timestamp: October 12, 2017, 12:15:28 pm
content: Its a PIC16/32, Explorer 16/32 boardI have a PIC24FJ1024GB610 100-pinI am programming in C.

author: Ian.M
author_rank: Super Contributor
timestamp: October 12, 2017, 12:57:36 pm
content: OK, so you'll need MPLAB X and Microchip XC16 installed. Both are easy to find on the Microchip website, and are linked from theExplorer 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.

author: rstofer
author_rank: Super Contributor
timestamp: October 12, 2017, 12:57:59 pm
content: 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.pdfThen you read the "Family Reference Manual - UART" document here:http://ww1.microchip.com/downloads/en/DeviceDoc/en026583.pdfThere'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.aspxFollowing 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.

author: rex1232
author_rank: Contributor
timestamp: October 12, 2017, 01:12:38 pm
content: thank you very much I will get right to it