Go to Post To me, being in FIRST is the biggest learning experience anyone can have. I want to give that experience to everyone I can, be it now or thirty years down the line. - BandChick [more]
Home
Go Back   Chief Delphi > Technical > Programming
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
 
 
Thread Tools Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #4   Spotlight this post!  
Unread 28-01-2007, 22:56
htwiz2002's Avatar
htwiz2002 htwiz2002 is offline
Htwizard
AKA: Anthony Takata Bawahawba
#1290
Team Role: Engineer
 
Join Date: Jan 2004
Location: Chandler, AZ
Posts: 23
htwiz2002 will become famous soon enough
Red face Re: Pointers/References?

I think I (might) have fixed it. (at least, it's not giving me errors anymore...)
The following is the example in entirety:
Code:
// Eepromhelper.c
#include "eeprom.h"
//Version verify codes:
unsigned char version1 = 0;
unsigned char version2 = 1;
unsigned char version3 = 1;
unsigned char version4 = 0;
//end verify codes...
// Verify codes are supposed to be for version check so in case the wrong version data is stored the robot will not use it (until saveing, which the robot will post a warning of overwrite (still in the works...))

// EEprom section:
void Terminal_eepromwriteset(char data1, char data2, char data3, char data4, unsigned char set) 
{
    //Consolidate this on verify that it works!!!
    unsigned int address = set * 4 -1;
    EEPROM_Write(address + 1, data1);
    EEPROM_Write(address + 2, data2);
    EEPROM_Write(address + 3, data3);
    EEPROM_Write(address + 4, data4);
}
void Terminal_eepromreadset(unsigned char set, unsigned char *data1, unsigned char *data2, unsigned char *data3, unsigned char *data4)
{
    //Consolidate this on verify that it works!!!
    unsigned int address = set * 4 -1;
    *data1 = EEPROM_Read(address + 1);
    *data2 = EEPROM_Read(address + 2);
    *data3 = EEPROM_Read(address + 3);
    *data4 = EEPROM_Read(address + 4);
}
void Limit_S0witch_Max(unsigned char switch_state, unsigned char *input_value, unsigned char *yep){}
char Terminal_loadFromEeprom(char set)
{
char rtn = 0;
    //This routine loads four char values from eeprom using a set switch te determine which bits to load.
    //Set starts with zero and also indicates what address to use (starting with zero)
    //Returns 0 if send to buffer success, 1 if read failed, 999 if set number is invalid
    //Make sure this information is mirrored in Terminal_saveToEeprom() !!!
switch (set)
{
case 0: //this is an example set, meant only for verification of data...
        //This is also viable for version verify, for automatic reset...
        Terminal_eepromreadset(0, &version1, &version2, &version3, &version4); break;
default: return 999; break;
}
return rtn;
}
//
char Terminal_saveToEeprom(char set)
{
    //This routine saves four char values to eeprom using a set switch te determine which bites to save.
    //Set starts with zero and also indicates what address to use (starting with zero)
    //Returns 0 if send to buffer success, 1 if buffer is full, 999 if set number is invalid
    //Make sure this information is mirrored in Terminal_loadFromEeprom() !!!
if (EEPROM_Queue_Free_Space() > 4)
{
switch (set)
{
case 0: //this is an example set, meant only for verification of data...
        //This is also viable for version verify, for automatic reset...
Terminal_eepromwriteset(version1, version2, version3, version4, 0); break;

default: return 999; break;
}
}
else
{
    return 1;
}
return 0;
}
// End eeprom section...
The full source is included (just in case someone wants to see a W.I.P.

Hope this can be helpful to some others
Attached Files
File Type: c terminal.c (19.4 KB, 108 views)
__________________
TsAuKpAeTrA (Anthony)
 


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
pic: Robonauts' Magnum Shoots 3 Pointers with WNBA Comets Natchez Extra Discussion 8 28-10-2006 20:26
Pointers in EasyC P1h3r1e3d13 Programming 6 13-03-2006 00:02
Can't use pointers nor refrences. cibressus53 Programming 9 05-11-2004 15:44
Pointers to structs? Jeff McCune Programming 2 17-02-2004 13:17
Laser Pointers.. archiver 2001 18 24-06-2002 00:08


All times are GMT -5. The time now is 17:43.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi