That EEPROM is certianly big enough. I'm sure there are a number of options, just depends on cost vs. what mets you needs for size/package/interface/etc.
What is the 'Best' thing for storing...
Type: Posts; User: SteveB; Keyword(s):
That EEPROM is certianly big enough. I'm sure there are a number of options, just depends on cost vs. what mets you needs for size/package/interface/etc.
What is the 'Best' thing for storing...
You ask about a "256KB EEPROM", but do you mean 256Kb? (Like the 24LC256?) If so, there is no way that would be big enough to hold all of the data. It only holds 32,767 Bytes. For your task, you...
You are correct, constants use no RAM, but variables use RAM space depenedent on their type.
So, if I understand the question, “Is there a difference between the following code snippets?”
MyByte VAR BYTE
MyByte = 155
MyByte VAR BYTE
MyCon CON 155
MyByte = MyCon
The answer is: No.
Looks good!
Untested, likely needs some debugging, but at least the methodology should be clear.
LCDPos VAR BYTE
volts VAR WORD ' 0 to 500 representing 0 to 50.0 Volts
Amps VAR BYTE ' 0 to 50 representing...
The I2C protocol shouldn't work open loop. The slave must send an ACK after each byte that is written. I would be very surprised if the PBP routines for I2C were written in a way that did not wait...
Seahound,
Take a look at the table (Table 1) on page 4 of the datasheet.
From what I can see, you can move the RX pin for the USART from RB1 to RB2. The SDA1 for I2C can not be moved, and is on...
Correct, count the number of pulses. Each pulse = .011" (.2794mm) of rain. This could be done with a general IO interrupt, or just poll it frequently if your main loop is quick and the pulse length...
I think this is what you are getting at.
WriteByte VAR BYTE
LED32 VAR WriteByte.3
LED32 = 0
But, lets say that this LED is actually attached to pin 3 of PORTB. In this case,...
For what you are doing, you can also use this method:
WaitForDoor:
IF DoorOpen <> 0 THEN WaitForDoor
Yes, a PIC is more than capable of interrupting at that frequency. The problem will be the reed switch.
If you use an un-bounced reed switch, you will likely catch a lot of bouncing, and the PIC...
Like Henrik said, the formula is really subtracting 4000 from a WORD. So here's the way I tackled it:
wCalc VAR WORD
G3T VAR wCalc[0]
G4T VAR wCalc[1]
IF wCalc <4000 THEN ...
Sorry, didn't mean to come across that way, just wanted to make sure my explanation was clear.;)
Not sure why [STR TEXT\5] didn't work, it should have. :confused:
addr var WORD
For addr = 0 TO 5 '
I2CRead memSDA,memSCL,$A1,addr,[STR TEXT\6] '$A0 does the same as $A1
pause 10
Next addr
Lets look at what...
Fanis,
Did you solve the problem?
I2CRead memSDA,memSCL,$A1,3,[text]
FYI, the "3" here is a constant, and is going to cause problems, since the 24LC256 needs a WORD addr.
try:
One other item. You have this comment: '$A0 does the same as $A1
I'm assuming this is a reference to the "Control" byte in the command.
The reason for this, is that the control byte for the...
One thing I see, is you keep writing over the top of the array "TEXT". Also, you don't need the FOR...NEXT loop to read sequentually.
Try just this:
I2CRead memSDA,memSCL,$A1,addr,[STR...
The code could also be changed thus, not that it makes a difference:
T1PS = 1 ; start with 1:1 postscaler
TimerConst = ((OSC*1000000)/4/100)+8 ; how many timer ticks...
Darrel,
While poking around and getting ideas, I got to looking at ver 1.2 of "Elapsed_INT-18.bas". I was particularly interested in the nice routine to calculate the timer reload constant:
'...
Here are some things I’d look into changing or using now that I look at it again. First, some easier changes:
- Not so much a change to the routines, but in how they are called. Use the new...
FWIW, here is an include file I put together (a long time ago) to use the Hardware I2C. It may be useful. It uses arrays as buffers to input and output data.
6749
It uses arrays as buffers to...
Thanks Darrel. :D
Glad to see it get fixed!
You might look into using the hardware I2C. You'd have to write some routines to deal with the data, but it will work well once you do.
I don't have an answer, just a quick suggestion to trouble shoot. Try putting another TRISB = %00010000 between the FOR...NEXT loops and see what that does. Also, if you use PORTB.6 = 1...PORTB.6 =...