Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

PIC Microcontroller Programming help

Status
Not open for further replies.

withloveshyam

Junior Member level 2
Joined
Mar 1, 2010
Messages
24
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,472
pic

pic11111111111111111111111111111111
 
Last edited:

Hi,

The joys of trying to follow and understand someone elses code !

I cannot spend ages trying to uderstand it all but some things quickly seen -

1. 208 gives 9615, so he has probably knocked off 21 to give 9594 which the actual instruction cycles will round up to an exact 9600

2. at the begining of each routine the FSR is set up by -
movlw adc_samples ; Setup sample buffer pointer
movwf FSR

3 & 4 this is all tied up in his use of a Software Usart to send the serial data to the PC.
Many of the larger Pics use a hardware Usart so making data sending so much easier.
Suggests you first follow and understand this tutorial which details a software usart and explains the timing signals and sequences.
PIC Tutorial* Seven - RS232
 
pic

pic111111111111111111111111111111
 
Last edited:

Hi,

Sorry, but it will take hours be break down that code and explain every line in detail.

If you want to understand it rather than just use the code you will have to practice some assembler to gain the experience.

If you want to modify his code then its often easier to write your own code from scratch then at least you fully understand it.

You could try running the code in MPlabsSIM debugger, here you can follow the code through line by line and watch the registers being updated - though not all functions will work 100%.
You can see in the SIM screenshot below that the instruction "adc_samples : 3 * 18 " generates a block of memory, 54 bytes used, before allocating the next variable.
 

Attachments

  • ScreenShot001.jpg
    ScreenShot001.jpg
    132.5 KB · Views: 63

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top