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.

[SOLVED] Microchip TCP/IP Stack - Helps Needed in Cooperate Multitasking

Status
Not open for further replies.

LongYC

Newbie level 2
Joined
Nov 1, 2010
Messages
2
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,296
Hi, I can't seem to make the Microchip stack works with a simple LED blinking program, I wish someone can give me an idea of what have I done wrong. Thank you.

Hardware:
PIC18F4620 with ENC28J60, the SPI is working fine, hardware components have no problem.

Compiler used:
C18, MPLAB deafult storage class is set to overlay.

Notes:
- Stack version: v5.31.
- The state constants are defined as 0x01, 0x02, etc. Tried '1', '2', etc, doesn't seem to be the problem.
- Everything works fine if I don't do it the cooperative multitasking way (no states) but it was too slow as tasks hogging the processor.

Code:
Code:
static unsigned char state; 
static TICK time; 

void main (void) 
{ 
    // ...... Initialize everything. 

     state = S_SET_DELAY; 

     while (1) 
     { 
         StackTask(); 
         StackApplications(); 
         MainApplication(); 
     } 
} 

void MainApplication (void) 
{ 
    switch (state) { 
         case S_SET_DELAY: 
              time = TickGet(); 
              state = S_DELAY_WAIT; 
              break; 
         case S_DELAY_WAIT: 
              if ( (TickGet() - time) >= 1*TICK_SECOND ) { 
                   state = S_DELAY_DONE; 
              } 
              break; 
         case S_DELAY_DONE: 
              state = S_RUN_LED; 
              break; 
         case S_RUN_LED: 
              RUN_LED ^= 1; 
              state = S_SET_DELAY; 
              break; 
         default: 
              break; 
     } 
}

By the way, I'm quite new in PIC microcntrollers as well as TCP/IP, is there any nice tutorial I can use? Especially about the Microchip TCP/IP stack. Thank you.
 

what exactly is your problem - are you missing TCP/UDP packets ? how much traffic is there?

I have used a PIC18F97J60 (which has an onboard Ethernet controller) with various devices attached (LCD, LEDs, barcode reader, RTC, IO extenders, etc) without problems. However, the traffic was low consisting of a data UDP packet transmiited every 10 seconds and a control UDP packet arriving a few times per hour.
If you have high traffic rates I would suggest moving to a PIC32MC6xx series.



if you do a web sreach for "microchip tcp ip stack tutorial" it will give you links to lots of information
 

Turned out it was the ISR bug of the TickGet() but thank you for your reply anyway, for your willingness to help.
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top