writer.h File Reference

Go to the source code of this file.

Data Structures

struct  WRITER_CONTROL

Functions

void F_WriterInit (void)
void F_WriterSvc (void)
void F_WriterImageWrite (void)
U8 F_WriterStateGet (void)

Variables

WRITER_CONTROL WriterCtrl


Function Documentation

void F_WriterImageWrite ( void   ) 

Definition at line 86 of file writer.c.

00086                              {
00087     WriterCtrl.State=WriterCheckHexfileState;
00088 }

void F_WriterInit ( void   ) 

Definition at line 31 of file writer.c.

U8 F_WriterStateGet ( void   ) 

Definition at line 83 of file writer.c.

00083                          {
00084     return WriterCtrl.State;
00085 }

void F_WriterSvc ( void   ) 

Definition at line 37 of file writer.c.

00037                       {
00038     U32 i;
00039 
00040     switch(WriterCtrl.State){
00041         case WriterIdleState:
00042             break;
00043         case WriterCheckHexfileState:
00044             pWriterStream=NULL;
00045             if(WriterFilename[0]!=0) pWriterStream=fopen((char *)WriterFilename,"rb");
00046             if(pWriterStream==NULL){                            
00047                 printf("\n Can not open file %15s.",WriterFilename);                                
00048                 WriterCtrl.State=WriterIdleState;
00049                 break;
00050             }
00051             for(i=0;i<WRITER_HEXFILE_SIZE;i++) WriterBuffer[i]=0xff;
00052             if(F_WriterHexfileCheck(pWriterStream)==TRUE){
00053                 printf("\n hex file check ok.");
00054             }
00055             else{
00056                 printf("\n hex file check fail.");
00057             }
00058             fclose(pWriterStream);
00059             //WriterCtrl.State=WriterIdleState;
00060             WriterCtrl.State=WriterTransmitHexfileState;
00061             break;
00062         case WriterTransmitHexfileState:
00063             #if(WRITER_DEBUG_ENABLE==1)
00064                 //F_WriterHexfileWrite();
00065                 F_IcspProgramModeEnter(); 
00066                 F_IcspBulkErase();           
00067                 //F_WriterHexfileWrite();
00068                 F_IcspProgramModeExit();
00069                 F_IcspReset();
00070             #else 
00071                 F_IcspProgramModeEnter(); 
00072                 F_IcspBulkErase();           
00073                 F_WriterHexfileWrite();
00074                 F_IcspProgramModeExit();
00075                 F_IcspReset();
00076             #endif
00077                 
00078             printf("\n write done. ");
00079             WriterCtrl.State=WriterIdleState;
00080             break;
00081     }
00082 }


Variable Documentation

Definition at line 17 of file writer.c.


Generated on Sun Jul 19 00:50:40 2009 for PROGRAMER FOR PIC18F87J10 USING LPT PORT by  doxygen 1.5.9