Searching \ for '[SX] how to read and write to eeprom 24LC32A?' in subject line. ()
Make payments with PayPal - it's fast, free and secure! Help us get a faster server
FAQ page: www.piclist.com/techref/ubicom/lib/mem/index.htm?key=eeprom
Search entire site for: 'how to read and write to eeprom 24LC32A?'.

Exact match. Not showing close matches.
PICList Thread
'[SX] how to read and write to eeprom 24LC32A?'
2009\01\08@170047 by eagletalontimn/a

flavicon
face
In SX Microcontrollers, SX/B Compiler and SX-Key Tool, eagletalontim wrote:

I just got my eeprom chips in today from Parallax and I cannot find any documentation on them on how to hook them up or to read/write to them :(  I need help getting started please :)
---------- End of Message ----------

You can view the post on-line at:
http://forums.parallax.com/forums/default.aspx?f=7&p=1&m=318680
Need assistance? Send an email to the Forum Administrator at forumadmin@parallax.com
The Parallax Forums are powered by dotNetBB Forums, copyright 2002-2009 (http://www.dotNetBB.com)

2009\01\08@174629 by JonnyMacn/a

flavicon
face
In SX Microcontrollers, SX/B Compiler and SX-Key Tool, JonnyMac wrote:

You're kidding, right?  Somehow you are able to use the Internet to post questions here but not locate information about the 24LC32?... that's funny.  There's this little company out here in California called Google -- you might might want to look into them.  :tongue:

I use EEPROMs in a lot of projects; the framework I've attached works fine with the 24LC32.

---------- End of Message ----------

You can view the post on-line at:
http://forums.parallax.com/forums/default.aspx?f=7&p=1&m=318680#m318694
Need assistance? Send an email to the Forum Administrator at forumadmin@parallax.com
The Parallax Forums are powered by dotNetBB Forums, copyright 2002-2009 (http://www.dotNetBB.com)

2009\01\08@175245 by JonnyMacn/a

flavicon
face
In SX Microcontrollers, SX/B Compiler and SX-Key Tool, JonnyMac wrote:

This will help, too: http://www.parallax.com/Portals/0/Downloads/docs/cols/nv/vol8/col/nv145.pdf
---------- End of Message ----------

You can view the post on-line at:
http://forums.parallax.com/forums/default.aspx?f=7&p=1&m=318680#m318695
Need assistance? Send an email to the Forum Administrator at forumadmin@parallax.com
The Parallax Forums are powered by dotNetBB Forums, copyright 2002-2009 (http://www.dotNetBB.com)

2009\01\08@183230 by eagletalontimn/a

flavicon
face
In SX Microcontrollers, SX/B Compiler and SX-Key Tool, eagletalontim wrote:

Sorry if they are extreme newbie questions, but I really could not find any information about how to read and write to it.  I did find the chip in microchips.com and found the data sheet, but there was nothing I could understand to help me read and write to it.

---------- End of Message ----------

You can view the post on-line at:
http://forums.parallax.com/forums/default.aspx?f=7&p=1&m=318680#m318704
Need assistance? Send an email to the Forum Administrator at forumadmin@parallax.com
The Parallax Forums are powered by dotNetBB Forums, copyright 2002-2009 (http://www.dotNetBB.com)

2009\01\08@195640 by JonnyMacn/a

flavicon
face
In SX Microcontrollers, SX/B Compiler and SX-Key Tool, JonnyMac wrote:

All kidding aside, you really should spend a few minutes learning to use Google.

---------- End of Message ----------

You can view the post on-line at:
http://forums.parallax.com/forums/default.aspx?f=7&p=1&m=318680#m318728
Need assistance? Send an email to the Forum Administrator at forumadmin@parallax.com
The Parallax Forums are powered by dotNetBB Forums, copyright 2002-2009 (http://www.dotNetBB.com)

2009\01\09@082039 by daveheinn/a

flavicon
face
In SX Microcontrollers, SX/B Compiler and SX-Key Tool, davehein wrote:

eagletalontim,
I think your request is reasonable for this forum.  Look at the sticky threads at the top of the SX forum.  The thread labeled "Best SX Threads ..." has lots of valuable information posted by others.  There are several posts related to using EEPROMs.  The sticky thread is located at http://forums.parallax.com/forums/default.aspx?f=7&m=182809 .

I did some work with EEPROMs a couple of years ago.  I spent a lot of time searching for information on the internet using AltaVista (I prefer it over Google).  I downloaded the data sheet for the EEPROM and studied it.  I couldn't get my code to work until someone on the forum pointed out that there was sample code in the SX tutorial book for an I2C interface.  I hadn't made the connection that a serial EEPROM device uses the I2C protocol.  I got my code working within hours after getting that valuable information.

Good luck on your project.  Please continue to post any questions you might have.

Dave
---------- End of Message ----------

You can view the post on-line at:
http://forums.parallax.com/forums/default.aspx?f=7&p=1&m=318680#m318819
Need assistance? Send an email to the Forum Administrator at forumadmin@parallax.com
The Parallax Forums are powered by dotNetBB Forums, copyright 2002-2009 (http://www.dotNetBB.com)

2009\01\09@164413 by eagletalontimn/a

flavicon
face
In SX Microcontrollers, SX/B Compiler and SX-Key Tool, eagletalontim wrote:

thanks for the links :)   I am finally able to write to the eeprom and can read back information that is stored using the program sent above.  A few things I still have a slight misunderstanding of is erasing the data on a certain address.  I tried putting PUT_EE eeAddr, "" and it did not erase what was put there.  Also....If I store a word variable say "1234" to address 0, what would be the next storage address?

I know I will probably be told to Google it, but 90% of the time, my searches come up with things that are not exactly what I am looking for and they are not coded in SX/B.  I am still learning the SX/B language so I have to ask questions to help me get farther.

---------- End of Message ----------

You can view the post on-line at:
http://forums.parallax.com/forums/default.aspx?f=7&p=1&m=318680#m318923
Need assistance? Send an email to the Forum Administrator at forumadmin@parallax.com
The Parallax Forums are powered by dotNetBB Forums, copyright 2002-2009 (http://www.dotNetBB.com)

2009\01\09@165330 by PJ Allenn/a

flavicon
face
In SX Microcontrollers, SX/B Compiler and SX-Key Tool, PJ Allen wrote:

There is definitely an I2C example in SX/B Help.

The address following Address 0?  It's Address 1.

An address can only hold a Byte, 8 bits.  A Word is two Bytes, 16 bits.  So, you have to break that into two Bytes (highbyte, lowbyte) and store each in a separate Address.

---------- End of Message ----------

You can view the post on-line at:
http://forums.parallax.com/forums/default.aspx?f=7&p=1&m=318680#m318929
Need assistance? Send an email to the Forum Administrator at forumadmin@parallax.com
The Parallax Forums are powered by dotNetBB Forums, copyright 2002-2009 (http://www.dotNetBB.com)

2009\01\09@171140 by eagletalontimn/a

flavicon
face
In SX Microcontrollers, SX/B Compiler and SX-Key Tool, eagletalontim wrote:

hmmm.  I am still having troubles with it.  It must be something in my code.  Here is what I have :

[CODE]DEVICE          SX28, OSCXT2, TURBO, STACKX, OPTIONX
FREQ            4_000_000
' -------------------------------------------------------------------------
' IO Pins
' -------------------------------------------------------------------------
LcdTx                VAR        RA.2                        ' LCD serial connection
SDA             PIN     RA.0 INPUT                    ' pull-up with 4.7K
SCL             PIN     RA.1 INPUT                    ' pull-up with 4.7K
' -------------------------------------------------------------------------
' Constants
' -------------------------------------------------------------------------
LcdBaud                CON        "T19200"                ' or T2400, or T9600
LcdBkSpc        CON     $08                    ' move cursor left
LcdRt           CON     $09                    ' move cursor right
LcdLF           CON     $0A                    ' move cursor down 1 line
LcdCls          CON     $0C                    ' clear LCD (need 5 ms delay)
LcdCR           CON     $0D                    ' move pos 0 of next line
LcdBLon         CON     $11                    ' backlight on
LcdBLoff        CON     $12                    ' backlight off
LcdOff          CON     $15                    ' LCD off
LcdOn1          CON     $16                    ' LCD on; no crsr, no blink
LcdOn2          CON     $17                    ' LCD on; no crsr, blink on
LcdOn3          CON     $18                    ' LCD on; crsr on, no blink
LcdOn4          CON     $19                    ' LCD on; crsr on, blink on
LcdLine1        CON     $80                    ' move to line 1, column 0
LcdLine2        CON     $94                    ' move to line 2, column 0
SlaveWr         CON     $A0                        ' for EEPROMs
SlaveRd         CON     SlaveWr | 1
Ack             CON     0
Nak             CON     1
EE_LAST                CON        $0FFF                        ' for 24LC32
' -------------------------------------------------------------------------
' Variables
' -------------------------------------------------------------------------
text                VAR        Word temp1                VAR        Byte                        ' subroutine work vars
temp2                VAR        Byte
temp3                VAR        Byte
temp4                VAR        Byte
temp5                VAR        Byte
i                VAR        Byte flags           VAR     Byte
ackNak         VAR     flags.0                 ' for I2C routines
i2cMulti        VAR        flags.1                        ' for I2C write eeAddr                VAR        Word
eeOut                VAR        Byte
eeIn                VAR        Byte tmpB1                VAR        Byte                        ' for subs/funcs
tmpB2                VAR        Byte
tmpB3                VAR        Byte
tmpW1                VAR        Word
' =========================================================================
 PROGRAM Start
' =========================================================================

' -------------------------------------------------------------------------
' Subroutine Declarations
' -------------------------------------------------------------------------
WAIT_MS                SUB        1, 2                        ' delay in milliseconds
LCD_OUT                SUB        1, 2                        ' send byte {+ count} to LCD
print                SUB        3, 4                        ' send string to LCD
clear                SUB        1, 2
EE_WAIT                SUB        0                        ' wait for EE to be ready
PUT_EE          SUB     3, 4                    ' write byte(s) to EEPROM
GET_EE          FUNC    1, 2                        ' read byte from EEPROM
GET_EE2                FUNC        2, 2                        ' read word from EEPROM
' I2C routines used by subs/funcs above
I2C_START       SUB     0                       ' generate I2C Start
I2C_STOP        SUB     0                       ' generate I2C Stop
I2C_OUT         SUB     1, 1                    ' write byte to SDA
I2C_IN          FUNC    1, 1                    ' read byte from SDA
' -------------------------------------------------------------------------
' Program Code
' -------------------------------------------------------------------------
Start:
 PLP_A = %0111                                        ' pull up unused pins
 PLP_B = %00000000
 PLP_C = %00000000
 HIGH LcdTx
 WAIT_MS 100                                        ' let LCD initialize
 LCD_OUT LcdOn1                                ' no cursor or blink
 LCD_OUT LcdCls                                ' clear the LCD
 LCD_OUT LcdLine1
 eeAddr = 0
 eeIn = GET_EE eeAddr
 WAIT_MS 50
 if eeIn <> 0 THEN
   print "Data Exists", 1, 1
   WAIT_MS 2000
   print "Data is : ", 2, 1
   print eeIn, 2, 11
   PUT_EE eeAddr, $FF
 ELSE
   print "Saving Data", 2, 3
   PUT_EE eeAddr, 12
   WAIT_MS 2000
   clear 2
   print "Retreiving...", 2, 2
   eeIn = GET_EE eeAddr
   WAIT_MS 2000
   clear 2
   print eeIn, 2, 1
 ENDIF
Main:
 WAIT_MS 500
 print eeIn, 2, 11
 GOTO Main

' -------------------------------------------------------------------------
' Subroutine Code
' -------------------------------------------------------------------------
' Use: WAIT_MS milliseconds {, multiplier }
' -- multiplier is optional
WAIT_MS:
 temp1 = __PARAM1                              ' get milliseconds
 IF __PARAMCNT = 1 THEN                        ' if no multiplier
   temp2 = 1                                   '   set to 1
 ELSE                                          ' else
   temp2 = __PARAM2                            '   get multiplier
 ENDIF
 IF temp1 > 0 THEN                             ' no delay if either 0
   IF temp2 > 0 THEN
     PAUSE temp1 * temp2                       ' do the delay
   ENDIF
 ENDIF
 RETURN
' -------------------------------------------------------------------------
LCD_OUT:
 temp1 = __PARAM1                                ' save the byte
 SEROUT LcdTx, LcdBaud, temp1                ' transmit to LCD
 RETURN
' -------------------------------------------------------------------------
clear:
 temp2 = __PARAM1
 print "                ", temp2, 1
 RETURN

print:
 IF __PARAMCNT = 3 THEN
   text = __PARAM1                            ' get string offset
   temp3 = __PARAM2
   temp4 = __PARAM3
 ELSE
   text = __WPARAM12                            ' get string offset
   temp3 = __PARAM3
   temp4 = __PARAM4
 ENDIF

 LCD_OUT LcdLine1
 IF temp3 = 1 THEN
   LCD_OUT LcdLine1
 ELSEIF temp3 = 2 THEN
   LCD_OUT LcdLine2
 ENDIF
 FOR temp5 = 1 TO temp4
   LCD_OUT LcdRt
 NEXT
 LCD_OUT LcdBkSpc
 
 DO
   READ text, temp5                            ' read a character
   IF temp5 = 0 THEN EXIT                      ' if 0, string complete
   SEROUT LcdTx, LcdBaud, temp5
   INC text                                   ' point to next character
 LOOP
 RETURN
SUB EE_WAIT
 DO  
   I2C_START
   I2C_OUT SlaveWr
 LOOP UNTIL ackNak = Ack
 ENDSUB
SUB PUT_EE
 IF __PARAMCNT = 3 THEN                        ' write one byte
   tmpW1 = __WPARAM12
   tmpB1 = __PARAM3
   i2cMulti = 0
 ELSE
   tmpW1 = __WPARAM12
   tmpB1 = __PARAM3
   tmpB2 = __PARAM4
   i2cMulti = 1
 ENDIF
 I2C_START
 I2C_OUT SlaveWr                               ' send slave ID
 I2C_OUT tmpW1_MSB                             ' send address, high byte
 I2C_OUT tmpW1_LSB                             ' send address, low byte
 I2C_OUT tmpB1                                 ' send data byte
 IF i2cMulti = 1 THEN
   I2C_OUT tmpB2                                ' send second data byte
 ENDIF
 I2C_STOP                                      ' finish
 '{$IFNDEF NOEEWAIT}
 DO                                            ' let write cycle finish
   I2C_START
   I2C_OUT SlaveWr
 LOOP UNTIL ackNak = Ack
 '{$ENDIF}
 ENDSUB
' -------------------------------------------------------------------------
FUNC GET_EE
 tmpW1 = __WPARAM12
 I2C_START
 I2C_OUT SlaveWr                               ' send slave ID
 I2C_OUT tmpW1_MSB                             ' send address, high byte
 I2C_OUT tmpW1_LSB                             ' send address, low byte
 I2C_START
 I2C_OUT SlaveRd
 tmpB1 = I2C_IN Nak
 I2C_STOP
 RETURN tmpB1
 ENDFUNC
' -------------------------------------------------------------------------
' Use: wordVal = GET_EE2 address
' -- reads [Little-Endian] 'wordVal' from EEPROM location 'address'
' -- 'address' is a word (0 to 65535)
FUNC GET_EE2
 tmpW1 = __WPARAM12
 I2C_START
 I2C_OUT SlaveWr                               ' send slave ID
 I2C_OUT tmpW1_MSB                             ' send address, high byte
 I2C_OUT tmpW1_LSB                             ' send address, low byte
 I2C_START
 I2C_OUT SlaveRd
 tmpW1_LSB = I2C_IN Ack
 tmpW1_MSB = I2C_IN Nak
 I2C_STOP
 RETURN tmpW1
 ENDFUNC
' -------------------------------------------------------------------------
' Use: I2C_START
' -- generates I2C start condition on SDA/SCL pins
SUB I2C_START
 I2CSTART SDA
 ENDSUB
' -------------------------------------------------------------------------
' Use: I2C_STOP
' -- generates I2C stop condition on SDA/SCL pins
SUB I2C_STOP
 I2CSTOP SDA
 ENDSUB
' -------------------------------------------------------------------------
SUB I2C_OUT
 I2CSEND SDA, __PARAM1, ackNak
 ENDSUB
' -------------------------------------------------------------------------
FUNC I2C_IN
 ackNak = __PARAM1.0
 I2CRECV SDA, __PARAM1, ackNak
 ENDFUNC[/CODE]
---------- End of Message ----------

You can view the post on-line at:
http://forums.parallax.com/forums/default.aspx?f=7&p=1&m=318680#m318934
Need assistance? Send an email to the Forum Administrator at forumadmin@parallax.com
The Parallax Forums are powered by dotNetBB Forums, copyright 2002-2009 (http://www.dotNetBB.com)

2009\01\10@060922 by eagletalontimn/a

flavicon
face
In SX Microcontrollers, SX/B Compiler and SX-Key Tool, eagletalontim wrote:

There must be something wrong with my PUT_EE sub.   I cannot get the print sub it to display a simple number like 12 unless I add quotations around it.  I am wanting to save a byte variable first, then be able to pull it from the eeprom and run it through some math function and then display it on the LCD.  The reason I made the print sub is so that when I have another chip talking to the display chip, I can send 3 parameters to it and it will know what line and character to put the text on.  It just makes it easier for me that way.

---------- End of Message ----------

You can view the post on-line at:
http://forums.parallax.com/forums/default.aspx?f=7&p=1&m=318680#m319013
Need assistance? Send an email to the Forum Administrator at forumadmin@parallax.com
The Parallax Forums are powered by dotNetBB Forums, copyright 2002-2009 (http://www.dotNetBB.com)

2009\01\10@063900 by PJ Allenn/a

flavicon
face
In SX Microcontrollers, SX/B Compiler and SX-Key Tool, PJ Allen wrote:

"I>

The Serial LCD understands everything you send it to be ASCII data; sometimes it's character code (letters, numerals, etc.), sometimes it's control code (line_feed, carriage return, etc.)[/color>

SEROUT'ing a decimal 12 (which is really a $0C), the SX knocks out a $0C, a control code for Form Feed.  SEROUT'ing a "12" makes the SX knock out the character codes for the numerals inside the quote_marks, a $31 and then a $32 for a numeral 1 and a numeral 2.
---------- End of Message ----------

You can view the post on-line at:
http://forums.parallax.com/forums/default.aspx?f=7&p=1&m=318680#m319019
Need assistance? Send an email to the Forum Administrator at forumadmin@parallax.com
The Parallax Forums are powered by dotNetBB Forums, copyright 2002-2009 (http://www.dotNetBB.com)

2009\01\10@065222 by eagletalontimn/a

flavicon
face
In SX Microcontrollers, SX/B Compiler and SX-Key Tool, eagletalontim wrote:

ok, that makes a little more sense :)  I am still a little confused on how the PUT_EE sub works.

Here is the code :

[CODE]SUB PUT_EE
 tmpW1 = __WPARAM12
 tmpB1 = __PARAM3
 I2C_START
 I2C_OUT SlaveWr                               ' send slave ID
 I2C_OUT tmpW1_MSB                             ' send address, high byte
 I2C_OUT tmpW1_LSB                             ' send address, low byte
 I2C_OUT tmpB1                                 ' send data byte
 I2C_STOP                                      ' finish
 '{$IFNDEF NOEEWAIT}
 DO                                            ' let write cycle finish
   I2C_START
   I2C_OUT SlaveWr
 LOOP UNTIL ackNak = Ack
 '{$ENDIF}
 ENDSUB[/CODE]
Now, I have tried to put PUT_EE eeAddr, 12 and it prints on the LCD "<<".  If I put PUT_EE, eeAddr, "12" it puts "11" on the LCD.  I am guessing it is something wrong with my print sub then?  I have been searching the help files and the forum and still cannot quite grasp what is going on.

Here is my updated "print" sub :

[CODE]print:
 IF __PARAMCNT = 3 THEN
   text = __PARAM1                            ' get string offset
   temp3 = __PARAM2
   temp4 = __PARAM3
   tmpB1 = 2
 ELSE
   text = __WPARAM12                            ' get string offset
   temp3 = __PARAM3
   temp4 = __PARAM4
   tmpB1 = 3
 ENDIF

 LCD_OUT LcdLine1
 IF temp3 = 1 THEN
   LCD_OUT LcdLine1
 ELSEIF temp3 = 2 THEN
   LCD_OUT LcdLine2
 ENDIF
 FOR temp5 = 1 TO temp4
   LCD_OUT LcdRt
 NEXT
 LCD_OUT LcdBkSpc
 
 IF tmpB1 = 3 THEN
   DO
     READ text, temp5                     ' read a character
     IF temp5 = 0 THEN EXIT                      ' if 0, string complete
     SEROUT LcdTx, LcdBaud, temp5
     INC text                                   ' point to next character
   LOOP
 ELSE
   DO WHILE tmpB1 > 0
     SEROUT LcdTx, LcdBaud, text
     DEC tmpB1
   LOOP
 ENDIF
 RETURN[/CODE]
---------- End of Message ----------

You can view the post on-line at:
http://forums.parallax.com/forums/default.aspx?f=7&p=1&m=318680#m319020
Need assistance? Send an email to the Forum Administrator at forumadmin@parallax.com
The Parallax Forums are powered by dotNetBB Forums, copyright 2002-2009 (http://www.dotNetBB.com)

2009\01\10@083700 by eagletalontimn/a

flavicon
face
In SX Microcontrollers, SX/B Compiler and SX-Key Tool, eagletalontim wrote:

ok, i just found a thread on here that may be what I need but I have no idea how to use the code.  It does not look like it will return anything...

[CODE]Bin16DEC:
' Use: Bin16DEC word
' -- Convert a 16bit binary variable into a decimal value.
'    define BLANK as 00h for BCD nibbles
'    define BLANK as 30h to directly output ASCII
'    to a terminal or LCD.
'    Original versions by Bean (Hitt Consulting) & Michael Chadwick & John Couture
'
' Setup
'    temp       VAR Byte
'    wTemp      VAR Word
'    wDivisor   VAR Word
'    ascDigit   VAR Byte (5)

 IF __PARAMCNT = 1 THEN   ' if parameter is a Byte or Word variable
   wTemp = __PARAM1
 ELSE
   wTemp = __WPARAM12
 ENDIF

 ' fill all locations with zeros
 PUT ascDigit(0), BLANK, BLANK, BLANK, BLANK, BLANK

 ' Loop for first 4 digits
 FOR temp = 0 TO 3
   ' Get divisior for this digit
   LOOKUP temp, 10000, 1000, 100, 10, wDivisor
   ' Increase digit until value < divisor
   DO UNTIL wTemp < wDivisor
     INC ascDigit(temp)
     wTemp = wTemp - wDivisor
   LOOP
 NEXT
 ' Last digit is just units, so just add it
 ascDigit(4) = ascDigit(4) + wTemp_LSB
 RETURN[/CODE]
Having just a RETURN with nothing to follow means that it will not return anything right?  I am basically looking for some way to convert a number variable into a word variable that can be show on the LCD
---------- End of Message ----------

You can view the post on-line at:
http://forums.parallax.com/forums/default.aspx?f=7&p=1&m=318680#m319040
Need assistance? Send an email to the Forum Administrator at forumadmin@parallax.com
The Parallax Forums are powered by dotNetBB Forums, copyright 2002-2009 (http://www.dotNetBB.com)

2009\01\10@091830 by eagletalontimn/a

flavicon
face
In SX Microcontrollers, SX/B Compiler and SX-Key Tool, eagletalontim wrote:

well, i am fixing to give up.  Google does not have my answers and I can't seem to understand how others have gotten it to work.  I am so confused on how to use a byte and a word.  From what I understand, a byte is a number 0 - 255, and a word can be a number 0 - 65535.  To pass a byte to a sub or function, you need to grab it with __PARAM# and to pass a word, you need to grab it with __WPARAM12.   Apparently, a byte cannot be shown on an LCD but a word can.  Since a Byte is 0 - 255, each number (2, 5, 5) will have to be saved in different addresses in an eeprom???  I have tried to save the number 12 to the eeprom, but I never get 12 back.  To display the byte that is received back from the eeprom, it will have to be converted to a word which I have no idea how to do.  I have browsed through all the help files and examples and have only found how to either display a full string of text OR display a number.....not both.

I need to be able to....

1 - Save a 0 - 255 number to the eeprom.
2 - Read the number back.
3 - Display the number on the LCD along with some pre-defined text.
4 - Use the number in a few math functions and display the result on the LCD.

---------- End of Message ----------

You can view the post on-line at:
http://forums.parallax.com/forums/default.aspx?f=7&p=1&m=318680#m319047
Need assistance? Send an email to the Forum Administrator at forumadmin@parallax.com
The Parallax Forums are powered by dotNetBB Forums, copyright 2002-2009 (http://www.dotNetBB.com)

2009\01\10@094316 by soshimon/a

flavicon
face
In SX Microcontrollers, SX/B Compiler and SX-Key Tool, soshimo wrote:

@Eagle - might I gently suggest that you start off small and perhaps study a little bit about the architecture of computers, microprocessers, and microcontrollers.  The fact that you are confused about bit/byte/word and storage sizes implies that you might not be as familiar with the architecture of computers to understand whats going on.  It's important to know a little bit about that little chip you are programming.  If you treat it as a black box then everything seems like magic, but once you learn how it "thinks" and "talks" then you can probably figure a lot of these things out on your own and that's always a much better feeling than having your hand held IMHO.  The primary reason you are not finding what you need is because you are asking too broad of a question from google.  Basically you are asking google "what the heck is programming and what is this SX/B thing?"  Of course google is going to give you a bunch of stuff because you asked such a broad question.  The fact is, if you learn a bit more about the architecture you will be in a much better position to ask the question you need to ask to get the answer you want.

That being said, I would start off on in the tutorial section.  Download all the labs.  Read any and all manuals and books that came with your SX/B - there might be something valuable in there.  I know the homework board had a book with it call "What's a Microcontroller" that would be a big help for you as well.  The only thing I can suggest is read, read, read.

---------- End of Message ----------

You can view the post on-line at:
http://forums.parallax.com/forums/default.aspx?f=7&p=1&m=318680#m319053
Need assistance? Send an email to the Forum Administrator at forumadmin@parallax.com
The Parallax Forums are powered by dotNetBB Forums, copyright 2002-2009 (http://www.dotNetBB.com)

2009\01\10@095847 by PJ Allenn/a

flavicon
face
In SX Microcontrollers, SX/B Compiler and SX-Key Tool, PJ Allen wrote:

Sometimes you need to walk away and have a pop, blow it off, come back later.

My suggestion is that you get the LCD'ing right, all on its own.  Get comfortable with displaying some CONstants (CON), VARs, or just plug numbers.  Then you can progress to the I2C reading/writing.


You can save 255 in one address, but displaying a number of two or more digits will require parsing, separating, that number's digits and sending each digit's ASCII code.

---------- End of Message ----------

You can view the post on-line at:
http://forums.parallax.com/forums/default.aspx?f=7&p=1&m=318680#m319057
Need assistance? Send an email to the Forum Administrator at forumadmin@parallax.com
The Parallax Forums are powered by dotNetBB Forums, copyright 2002-2009 (http://www.dotNetBB.com)

2009\01\10@105908 by eagletalontimn/a

flavicon
face
In SX Microcontrollers, SX/B Compiler and SX-Key Tool, eagletalontim wrote:

thanks for the info!  I got up for a bit to cool off and now I have restarted all my code and am working with just the LCD right now.  I will wait for the eeprom later.  After viewing the SEROUT example, I have been able to come up with the ability to put text and variables on the screen at the same time :)  I only have one problem that I cannot figure out.... Anywhere that a character is not defined on the LCD, it puts a \.  On line 1, I have the text "Working..."  but on the display it shows "Working...\\\\\\".  Any ideas what is causing that?

[CODE]DEVICE          SX28, OSCXT2, TURBO, STACKX, OPTIONX
FREQ            4_000_000

' -------------------------------------------------------------------------
' IO Pins
' -------------------------------------------------------------------------
LcdTx                VAR        RA.2                        ' LCD serial connection

' -------------------------------------------------------------------------
' Constants
' -------------------------------------------------------------------------
LcdBaud                CON        "T19200"                ' or T2400, or T9600
LcdBkSpc        CON     $08                    ' move cursor left
LcdRt           CON     $09                    ' move cursor right
LcdLF           CON     $0A                    ' move cursor down 1 line
LcdCls          CON     $0C                    ' clear LCD (need 5 ms delay)
LcdCR           CON     $0D                    ' move pos 0 of next line
LcdBLon         CON     $11                    ' backlight on
LcdBLoff        CON     $12                    ' backlight off
LcdOff          CON     $15                    ' LCD off
LcdOn1          CON     $16                    ' LCD on; no crsr, no blink
LcdOn2          CON     $17                    ' LCD on; no crsr, blink on
LcdOn3          CON     $18                    ' LCD on; crsr on, no blink
LcdOn4          CON     $19                    ' LCD on; crsr on, blink on
LcdLine1        CON     $80                    ' move to line 1, column 0
LcdLine2        CON     $94                    ' move to line 2, column 0 text                VAR        Byte
idx                VAR        Byte                        ' loop counter
line1                VAR        Byte(16)                ' line 1 buffer
line2                VAR        Byte(16)                ' line 2 buffer temp1                VAR        Byte                        ' subroutine work vars
temp2                VAR        Byte
temp3                VAR        Byte
temp4                VAR        Byte
temp5                VAR        Byte


' =========================================================================
 PROGRAM Start
' =========================================================================

' -------------------------------------------------------------------------
' Subroutine Declarations
' -------------------------------------------------------------------------
wait                SUB        1, 2                        ' delay in milliseconds
LCD_OUT                SUB        1, 2                        ' send byte {+ count} to LCD
LCD_STR                SUB        2                        ' send string to LCD
UPDATE_L1        SUB        0                        ' update line 1 of LCD
UPDATE_L2        SUB        0                        ' update line 2 of LCD
' -------------------------------------------------------------------------
' Program Code
' -------------------------------------------------------------------------
Start:
 PLP_A = %0111                                        ' pull up unused pins
 PLP_B = %00000000
 PLP_C = %00000000
 HIGH LcdTx
 wait 100                                        ' let LCD initialize
 LCD_OUT LcdOn1                                ' no cursor or blink
 LCD_OUT LcdCls                                ' clear the LCD
 wait 5
 text = 255
 PUT line1, "Working..."
 PUT line2, "Var :"
Main:
 temp1 = text / 100
 temp2 = __REMAINDER
 temp1 = temp1 + "0"
 PUT line2(6), temp1
 temp1 = temp2 / 10
 temp2 = __REMAINDER
 temp1 = temp1 + "0"
 PUT line2(7), temp1
 temp1 = temp2 + "0"
 PUT line2(8), temp1
 UPDATE_L1
 UPDATE_L2
 wait 1000
 text = text - 1
 if text = 0 then
   text = 255
 endif
 GOTO Main

' -------------------------------------------------------------------------
' Subroutine Code
' -------------------------------------------------------------------------
' Use: WAIT_MS milliseconds {, multiplier }
' -- multiplier is optional wait:
 temp1 = __PARAM1                              ' get milliseconds
 IF __PARAMCNT = 1 THEN                        ' if no multiplier
   temp2 = 1                                   '   set to 1
 ELSE                                          ' else
   temp2 = __PARAM2                            '   get multiplier
 ENDIF
 IF temp1 > 0 THEN                             ' no delay if either 0
   IF temp2 > 0 THEN
     PAUSE temp1 * temp2                       ' do the delay
   ENDIF
 ENDIF
 RETURN
SUB UPDATE_L1
 LCD_OUT LcdLine1
 wait 5
 FOR idx = 0 TO 15
   LCD_OUT line1(idx)                                ' transfer buffer
 NEXT
ENDSUB
SUB UPDATE_L2
 LCD_OUT LcdLine2
 wait 5
 FOR idx = 0 TO 15
   LCD_OUT line2(idx)                                ' transfer buffer
 NEXT
ENDSUB
LCD_OUT:
 temp1 = __PARAM1                                ' char to send
 IF __PARAMCNT = 1 THEN                        ' if no repeats specified
   temp2 = 1                                        ' - set to 1
 ELSE
   temp2 = __PARAM2                                ' - save repeats
 ENDIF
 DO WHILE temp2 > 0
   SEROUT LcdTx, LcdBaud, temp1                ' transmit to LCD
   DEC temp2
 LOOP
 RETURN
' -------------------------------------------------------------------------
' Use: LCD_STR [ string | label ]
' -- "string" is an embedded literal string
' -- "label" is DATA statement label for stored z-String
LCD_STR:
 temp3 = __PARAM1                              ' get string offset
 temp4 = __PARAM2                              ' get string base
 DO
   READ temp4 + temp3, temp5                   ' read a character
   IF temp5 = 0 THEN EXIT                      ' if 0, string complete
   LCD_OUT temp5                                    ' send the byte
   INC temp3                                   ' point to next character
   temp4 = temp4 + Z                           ' update base on overflow
 LOOP
 RETURN[/CODE]
---------- End of Message ----------

You can view the post on-line at:
http://forums.parallax.com/forums/default.aspx?f=7&p=1&m=318680#m319080
Need assistance? Send an email to the Forum Administrator at forumadmin@parallax.com
The Parallax Forums are powered by dotNetBB Forums, copyright 2002-2009 (http://www.dotNetBB.com)

2009\01\10@115011 by eagletalontimn/a

flavicon
face
In SX Microcontrollers, SX/B Compiler and SX-Key Tool, eagletalontim wrote:

ok, I got it :)  I changed the LCD_OUT to :

[CODE]LCD_OUT:
 temp1 = __PARAM1                                ' char to send
 IF __PARAMCNT = 1 THEN                        ' if no repeats specified
   temp2 = 1                                        ' - set to 1
 ELSE
   temp2 = __PARAM2                                ' - save repeats
 ENDIF
 DO WHILE temp2 > 0
   IF temp1 = $00 THEN
    SEROUT LcdTx, LcdBaud, " "
   ELSE
    SEROUT LcdTx, LcdBaud, temp1                ' transmit to LCD
   ENDIF
   DEC temp2
 LOOP
 RETURN[/CODE]
Time to get up and do something else before tackling the EEPROM :|
---------- End of Message ----------

You can view the post on-line at:
http://forums.parallax.com/forums/default.aspx?f=7&p=1&m=318680#m319088
Need assistance? Send an email to the Forum Administrator at forumadmin@parallax.com
The Parallax Forums are powered by dotNetBB Forums, copyright 2002-2009 (http://www.dotNetBB.com)

2009\01\10@124939 by eagletalontimn/a

flavicon
face
In SX Microcontrollers, SX/B Compiler and SX-Key Tool, eagletalontim wrote:

I thank everyone who helped me understand this better!  I was finally able to display text and variables on the LCD, write to the EEPROM, read from the eeprom and use the data in math formulas :)  I wound up having to redo all the code, but it was well worth it!

One think I found out is that Google does not always have the answer!

---------- End of Message ----------

You can view the post on-line at:
http://forums.parallax.com/forums/default.aspx?f=7&p=1&m=318680#m319105
Need assistance? Send an email to the Forum Administrator at forumadmin@parallax.com
The Parallax Forums are powered by dotNetBB Forums, copyright 2002-2009 (http://www.dotNetBB.com)

More... (looser matching)
- Last day of these posts
- In 2009 , 2010 only
- Today
- New search...