PDA

View Full Version : writting code for a 16 X 16 Table



CrazyCooter
- 30th November 2006, 08:24
This is my 1st post so i hope i got the right spot
i have PBP2.46

working with a PIC16f877a
having dificulties understanding the book on writting a table that is 16X16 see below

0123456789012345
1.......................
2.......................
3.......................
4.......................
5.......................
6.......................
7.......................
8.......................
9.......................
0.......................
1.......................
2.......................
3.......................
4.......................
5.......................

all the spots will be placed with a linnear line of numbers ie 14.7,11.2,15.8 etc
this project is for measuring the air/fuel ratio on a car and displaying on a lcd.

any help would be great.

Crazy Cooter

Acetronics2
- 30th November 2006, 09:01
FIRST ...

PbP only works with INTEGERS !!!

SECOND ...

PbP Works with Words ... where's your problem, then ???

THIRD ...

A look to JAYCAR ( Australia ) products could show you THE gadget you look for ... already cooked ... and working ( ! )

Alain

sayzer
- 30th November 2006, 10:09
all the spots will be placed with a linear line of numbers ie 14.7,11.2,15.8 etc




...
PbP only works with INTEGERS !!!
....


As Alain said, integers would be your problem but, if you can say that your linear line of numbers will never get above 25.5 then you can get around it by storing the whole number by multiplication of 10.

And read them back by dividing by 10 (also a second division for remainder).


---------------



-----------------------

HenrikOlsson
- 30th November 2006, 13:05
Hi,
What is the maximum value that you want to store in the table and how many decimals do you need/want?

Is the table supposed to be in RAM, internal EEPROM, external EEPROM or program memory?

As the guys said before, PBP works with integers only so you cant just store the value 14.7 but depending on the largest number you need to store there's probably a few ways around that.

Then when you have your table, how will you access it? By row/column or....?

/Henrik Olsson.

skimask
- 30th November 2006, 14:22
And probably going to use a standard 3 wire O2 sensor, narrowband thing.
Not going to work...
JDG

CrazyCooter
- 1st December 2006, 03:05
Thanks to everyone that responded. Its been great.

This project is for a fuel injected rideon. i have compleded an analogue circuit and it works ok. but i am not 100% happy with it. the o2 sensor is sensing if the engine is rich or lean. the pic's (16f877a @ 20MhZ) job is to make sure it stays correct at 14.7 with injecting the correct amount of fuel at its given RPM / LOAD thats why i am needing a table.

The max rpm the engine will do is 3600

Is there any way to make the table bigger than 16 X 16
ie 64 X 64?


thanking all in advance

mister_e
- 1st December 2006, 03:10
Yes, use an external EEPROM or use a variant of 'Embedded string in your CodeSpace' thread

skimask
- 1st December 2006, 03:16
And again, you do realize that a regular 2 wire O2 sensor doesn't tell you what your A/F ratio is, it just tells you if you're running rich or lean. And it only tells you that if let it switch between rich and lean.
The ECM's don't try to maintain an exact .5v from the O2 sensor (that's practically impossible), they run the engine just a bit leaner, wait for the O2 sensor voltage to drop, then run it a bit richer, wait for the O2 sensor to rise, the start the process over again. They call it 'O2 sensor crosscounts'. On normal engines (well, ok, mine for example, '01 Dodge Ram), I measure around 30 cross counts, which means 30 times second, my truck's computer has recognized that the O2 sensor has swung lean, so it richens up the mixture, then it see the O2 sensor swing rich, so it lean out the mixture.

See that?

Do a Google search for 'MegaSquirt' do-it-yourself fuel injection system, you'll see what I mean by all this.

JDG