Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Topics - sparkcatcher

Pages: [1]
It looks to me like the GetTickDiff functions within the Tick.h module of the V3.05 stack could provide unintended responses, but I'm unsure do to my ignorance of the subtraction methodology used with the PIC processor in the case of an overflow condition (ie substrating a larger number from a smaller one).

It looks like these functions simply subtract the stored Tick value (the test value) from the current tick value.

In most cases this differential would be correct.  However in the case where the tested value is closer to the rollover value than the test interval, then the differential value returned would not be as intended by the name of the function.

Here's an example use GetTickDiffSec(t) which has a range of 18 hours.

I store a time:  testTime = TickGetSec()
I want to execute a command every 4 hours, so my test interval is 14400 (4 x 60 x 60)
The TickGetSec() tick counter rolls over to zero at around 64800 (18 hours, or around there)

Lets say everything starts at zero.  For the first four iterations the function TickGetDiffSec(testTime) returns the correct differential between the tick clock and my stored time.  Every time the TickGetDiffSec(testTime) function is greater than 14400, my routine executes, and then I update the current time testTime=TickGetSec().  The 4 hour count process begins again. 

There will come a time when I store a value like testTime=TickGetSec() will equal say 57600 (4 x 14400).  The TickGetSec counter however rolls over at 64800 (or close to that).   When the TickGetSec() counter rolls over, it becomes 0, and at that point, the function TickGetDiffSec(testTime) returns ( 0 - 57600) which I presume to be some large number because of binary subtraction overflow.  The result is that the event occurs prior to 4 hours, in this case, more like two hours.

Caveat:  I'm not sure exactly how subtraction of a larger number from zero works within the PIC instructions.  I'm vaguely familiar with 1's complement arithmetic, so it could be that the situation takes care of itself.

Can anyone confirm whether the TickGetDiff functions (any tick function that returns a differential between current time and stored time) return the absolute value of the difference?   


I have the beta code version 3.04.  I'm working with an sbc45 R2.  The code works.  I'm playing with the projdef file.  Within the projdefs file, I commented out the define NIC_DISABLE_IOCHRDY.  After I did this I rebuilt and reprogrammed, and while the serial port config program worked, I could not communicate with the board using the http server.   When I went back and un-commented the NIC_DISABLE_IOCHRDY define, rebuilt, reprogrammed, and the HTTP server again worked.  I checked my board to confirm that the jumper JP5 was indeed connected.

I also noticed that the file /net/mac.h  has a duplicate define for NIC_DISABLE_IOCHRDY and this is also an active define by default for this code set.    I'm thinking that the writers of the software really wanted to make sure  :-o that NIC_DISABLE_IOCHRDY define should be enabled so the stack shouldn't use the IOCHRDY pin coming from the realtek chip.

What is the downside of not using the IOCHRDY pin?  Will this slow down packet processing or cause problems within the stack?  Why is it causing problems when I comment out the NIC_DISABLE_IOCHRDY define?

Ethernet Boards (8-bit) / SBC45EC Using HTTP Server Port Value Question
« on: October 30, 2006, 10:18:36 AM »
I have a new SBC45EC board that I'm testing out.  I'm able to to access the Modtronix web server and set the ports as either input or output and also view the port settings through the web server.  Everything seems to be working as advertised, except one quirky thing that may need further explanation.

I've set all of the Port B port settings to "output" by checking the boxes on the appropriate web server page, and then clicking submit (numerous times).

Next, I go to the port values page and set all of the port B output pins to "1", by clicking the appropriate buttons.  And then click "update." 

Then without making any further changes, I click the "update" button again, actually many more times, as an example, ten times, once a second.

I notice that the output pins all retain their "1" value, as expected, with the exception of B6.  B6 toggles between 0 and 1 seemingly randomly as I click update. 

I don't have any connection on the ICD port.  I noticed in the modtronix docs that both B7 and B6 are also used for ICD.

I'm wondering if anyone can tell me why this happens, if it is normal, and what to do to ensure that the output values remain as selected (ie, a 1 remains a 1).  I've read in some previous posts on this forum regarding other boards about the possible need for a pullup or pulldown resistor.  Is this a necessity on this pin?

thanks for any help.

Programming / Programming SBC45 with Microchip ICD2
« on: October 17, 2006, 06:14:38 PM »
I have just received a new Microchip ICD2.  The contents contains a design advisory in which they talk about AC grounding.

They state that if power is supplied to the target application, which in this case is the SBC45 board, that power should not be applied to the ICD2 unit, and that an optoisolated USB hub be used to attach the ICD2 pod to the computer.  This effectively isolates the computer from the development system.

My question:  Will the SBC45 board power supply support the power requirements of the MPLAB ICD2 module?  Or how do you recommend applying power to the ICD2 POD for programming and developing on the SBC45 board?

Any thoughts or comments on this are appreciated.

Pages: [1]