Searching \ for '[SX] Serial (backlit) and Parallel LCD support for' 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/io/index.htm?key=lcd
Search entire site for: 'Serial (backlit) and Parallel LCD support for'.

Exact match. Not showing close matches.
PICList Thread
'[SX] Serial (backlit) and Parallel LCD support for'
2005\11\11@194235 by tdg8934n/a

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

I just got the SX Tool Kit Pro (with a Professional Development board). I also bought the 2x16 backlit Serial LCD from Parallax (built in SX28 controller). I also bought a 2x16 non backlit parallel LCD. In case I could not find support for one, I would have the other to start with.  

The problem I have is not finding any program for the SX28 for either. What I found wants to have a BS2 connected (only BS2 software provided - nothing for SXB with schematics).


Please help if you can.


Thanks.

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

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

2005\11\11@203046 by Chris Savagen/a

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

Tim,
  Perhaps you can be the first to write an SX/B code for using the Parallel Display!  It shouldn't be too hard to convert the BS2 code over to it.  It's really a matter of sending Data or Instructions to the LCD by setting the proper control lines (RS and R/W), making the data available to the 4-bit interface (DB4-DB7) and toggling the Enable line (Twice for each, since it's 4 bit).  Put the whole thing in a subroutine so that all you have to do is set a variable and call it!  =)
---------- End of Message ----------

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

2005\11\11@213942 by peterverkaikn/a

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

http://www.sxlist.com/techref/ubicom/virtperf.htm
Scroll down to 8bit LCD interface, there is also a 4bit LCD interface
An serial LCD example is in the SX/B IDE help section.

regards peter
---------- End of Message ----------

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

2005\11\12@053422 by beann/a

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

Tim,
 In the help file there is a "Serial LCD" project. This is NOT about using a serial LCD, it is about MAKING a serial LCD using a standard parallax LCD.

 That should get you started.
Bean.

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

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

2005\11\12@054801 by tdg8934n/a

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

Thanks for all the information.

Perhaps I will be the first to create this. We'll see.

I guess what I was looking for is a way to control either the parallel or serial (sx28 modified already - it looks like) directly by the SX28 without having to use a BS2. If nothing is out there, that's fine but I just would have thought that it would have been done already since the PDB supports both the BS2 and SX28 (having an LCD parallel port).

I'll see what I can come up with after I learn the SX28 some more. So much to remember with SX28 Assembly language. This will take some time...

I have already read through the downloaded manual "Exploring the SX microcontroller with Assembly and Basic v3".

Are there any other guides / books that go into the SX/B BASIC coding more than just the help file?

Thanks again,
Timothy Gilmore
---------- End of Message ----------

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

2005\11\12@073745 by Forrestn/a

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

If you want to control a serial LCD with an SX28 you'll need to first program the SX28 without a resonator installed and then install a resonator for the SX28 after programming. The reason is the internal clock on the SX28 isn't accurate enough for serial communication at a fixed baud rate.

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

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

2005\11\12@075153 by Jon Williamsn/a

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

Tim,
You'll find a few examples in the SX/B help file that use the SEETRON serial LCD -- this will give you a starting point for using the Parallax LCD (you will need to make some modifications, but the examples show how to send bytes).  And as Bean pointed out, there is a full-fledged DIY serial LCD project in the help file as well, so that will show you how to do 8-bit parallel interfacing.

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

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

2005\11\12@102030 by Chris Savagen/a

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

Peter, et al,
  Yes, there is an SX/B LCD example using 8-bit mode (Which I prefer), but for the 4-bit mode (Using less I/O) there is no SX/B example to complement our BS2 version.  It's slightly more difficult to do than 8-bit, since you have to do two 4-bit transfers for each byte sent.

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

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

2005\11\12@113335 by tdg8934n/a

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

I really appreciate the support provided. However, what I will work on first is SX/B (maybe assembly too...later) for the Serial LCD (has SX28 surface mount circuit embedded already). Since all that is available is BS2 example code (well done), it needs SX28 (SX/B and / or assembly) code written too. I don't think this will be too difficult once I look at SX/B first. Once finished I will tackle the 4 bit conversion of BS2 code into SX/B (maybe assembly...later).

Thanks again to all.

Timothy Gilmore
---------- End of Message ----------

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

2005\11\12@142837 by Chris Savagen/a

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

Tim,
  If you look carefully at the many BS2 4-bit LCD programs, you will notice that the ones Parallax has written have the code for sending the data out to the LCD stuffed into a subroutine.  Both nibbles of the data are sent out to the LCD during each transaction, making it fairly easy to understand.  I think you can do it, and then get fame for it!  =)  At least here on the forums!

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

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

2005\11\12@181040 by tdg8934n/a

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

SX/B "Serial" LCD firmware is written and working - No BS2 required.

I have written SX/B code to work with a SX28 (NO BS2 REQUIRED) and the Parallax Serial LCD. Either Parallax model (#27976 Non Backlit) or (#27977 Backlit version) will work well. It works almost identically to the Parallax docomentation with example subroutines provided to display a DATA message , create custom characters and turn the backlight off or on. Other subroutines can be easiliy created using my example subroutines and the Parallax documentation.


http://www.parallax.com/detail.asp?product_id=27976
http://www.parallax.com/detail.asp?product_id=27977

It was a good first SX/B project to work on.


Let  me know what you think and if you want to use it on the Parallax website (as is or modified is ok).


Thanks,

Timothy Gilmore
---------- End of Message ----------

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

2005\11\13@053640 by Jon Williamsn/a

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

Tim,
I'm in a seminar this weekend and only have an hour in the mornings.  On Monday I will adapt the Parallax Serial LCD demo to SX/B -- it can be done in one's sleep and hands bound ... give it a try!

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

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

2005\11\13@054246 by Jon Williamsn/a

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

Tim,
You'll find as your programs start to grow that you'll want to embed SEROUT into a subroutine as we do in the help file demos.  Why?  Because SX/B is an inline (some call macro) compiler, and each high-level command (like SEROUT) is directly translated into assembly.  So in your program, you have lots of redundant assembly code.  The cool thing about embedding big commands into a subroutine is that you save code space and you can add features.  This subroutine, for example, will transmit one character, or if specified, that same character up to 255 times.

' Use: TX_BYTE theByte {, repeats }
' -- first parameter is byte to transmit
' -- second (optional) parameter is number of times to send
TX_BYTE:
 temp1 = __PARAM1                              ' char to send
 IF __PARAMCNT = 1 THEN                        ' if no repeats specified
   temp2 = 1                                   ' - set to 1
 ELSE
   temp2 = __PARAM2
 ENDIF
 DO WHILE temp2 > 0
   SEROUT Sout, Baud, temp1                    ' send the character
   DEC temp2
 LOOP
 RETURN

If you think about it, when we do this we're becoming somewhat Stamp-like.  Inside the BASIC Stamp is one core assembly routine that gets called from our program as we need it.

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

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

2005\11\13@062724 by tdg8934n/a

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

Jon,
I really appreciate the insight to this. As I am new to this...Do I "Compile" or "Program" the SX/B code first and then look at the assembly language to change it. What if I re-"compile" or "program" it? Does it change my program?

Can you explain the process to which you are refering to?

Thanks,
Timothy Gilmore
---------- End of Message ----------

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

2005\11\13@063905 by tdg8934n/a

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

Jon,
Are you just saying that I should rewrite the SX/B code to use one subroutine for the SEROUT process and this would fix the problem...or do I have to go into the actual .SRC code and change that?

PS: What does "Compile", "Program" and "Run" do?

When I click on Compile, I don't see it doing anything.

When I click on Program, it erases and reprograms the SX28.

When I click on Run, it erases and reprograms the SX28 but it also stated that the SX-Key is generating a 4 MHz signal (can't remember exact wording).

Thanks,
Timothy Gilmore
---------- End of Message ----------

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

2005\11\13@072011 by Jon Williamsn/a

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

Your program probably works but is consuming tons of code space because SX/B is turning every instance of SEROUT into several lines of assembly code.  If you move SEROUT to a subroutine, then it only gets expanded once and you save a lot of code space.  And, as I showed above, you can add features when you encapsulate "big" SX/B functions into a subroutine.  There are several examples in the help file that demonstrate this.

See page 23 of the SX manual for a complete description of the IDE controls.

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

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

2005\11\13@072452 by beann/a

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

Tim,
 It won't do any good to change the .SRC file, because when you "compile" again it will get recreated.
 Jon isn't saying to change the code generated by the compiler, he's saying to put the SX/B SEROUT command inside an SX/B subroutine.

 If you want to put assembly in your SX/B program you can prefix each assembly line with a "\" or use the ASM...ENDASM commands.

Bean.

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

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

2005\11\13@095914 by johncouturen/a

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

Tim,
If I may so humbly add to this conversation.  Attached is a schematic and code for sending data to an LCD using the 4 bit technique.  I designed the code to handle any geometry (1x16, 4x20, etc) LCD and also demonstrate a couple of techniques that Jon Williams, Bean, Gunther Daubach and Aristides Alvarez have presented on things such as interrupts, arrays and such.  These guys are the greatest!

Also included is a data sheet on the Hitachi HD44780 chip (Most LCD's are based on this chip)  and a links to an article from Practical Electronics that talks about how to program an LCD.

The file is a zip file because it consists of seven files:

  • LCD-4bit-Demo.bmp - the schematic
  • LCD-4bit-Demo.sxb - the main program
  • LCD-sxt - the LCD subroutines
  • LCD-con.sxt - the LCD constants
  • LCD-sub.sxt - the LCD subroutine declarations
  • LCD-var.sxt - the LCD variables
  • HD44780.pdf - datasheet

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

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

2005\11\13@112816 by Chris Savagen/a

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

[Quoting: "Chris Savage (Parallax)"]
Perhaps you can be the first to write an SX/B code for using the Parallel Display!  It shouldn't be too hard to convert the BS2 code over to it.  It's really a matter of sending Data or Instructions to the LCD by setting the proper control lines (RS and R/W), making the data available to the 4-bit interface (DB4-DB7) and toggling the Enable line (Twice for each, since it's 4 bit).  Put>  
=)  That was what I was referring to back in my message.  Guess I should've mentioned why you should do that too, huh?

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

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

2005\11\13@124612 by tdg8934n/a

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

I made the SEROUT into a Subroutine as Jon stated.

However, now it appears that I am still running out of program space. I can't believe this as the program is not that big. Do I have to change to another memory bank or something? I have attached my SX/B code that programs fine. However, if you un-comment the char3 DATA line and / or the CustomCharacter3 subroutine and try to program, it comes back with an error message:


Line 216, Error 44, Pass 2: Address 260 is not within lower half of memory page.


What does this exactly mean and how do I fix it besides commenting out my program?


Thanks,

Timothy Gilmore
---------- End of Message ----------

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

2005\11\13@145122 by johncouturen/a

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

Tim,
There is indeed a limited of variables that you can have with the SX (SX28=20 and SX48=18).  However, the good news is that you can reuse variables by using aliases (see SX/B under  HELP / Reference / Aliases).  Another trick is to use arrays.  I used both tricks in my code above.

Also, you need to declare you surbroutines and how many parameters they should expect (HELP / Reference / Definitions / Subroutine Declaration)
Add the following lines right after your BAUD con statement.

DisplayingText SUB
CustomCharacter0 SUB
CustomCharacter1 SUB
CustomCharacter2 SUB
CustomCharacter3 SUB
Lighton sub
lightoff sub
---------- End of Message ----------

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

2005\11\13@152250 by tdg8934n/a

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

John,
That worked. I have been reading all day about memory pages, Assembly stuff and not quite getting a good picture. It's nice when you can call on the forum and get great support.

PS: I put the SUB statements you provided in the 'Subroutine Declarations' area of my program which is listed in the SX/B template. So that's what that was for.

Do we have switch pages in memory using Assembly MOV FSR or BANK type commands for subroutines or does the SUB statements do that?

Thanks again!

Timothy Gilmore
---------- End of Message ----------

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

2005\11\13@161723 by johncouturen/a

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

No, I made that mistake also.  SX/B does all of the grunt work for you.  You just have to keep track of how many variables you have and the compiler does the rest.  Learn how to use Arrays and Interrupts .... its worth the effort!  Opens up LOTS of new possibilities.

I did the LOAD commands because I was getting tired of VERY LONG programs.  By breaking it up into modules, I can debug that portion then forget about it.

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

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

2005\11\13@165440 by tdg8934n/a

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

Here is Revision B of the SX/B Serial LCD program (attached).

Thanks to all!

Timothy Gilmore
---------- End of Message ----------

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

2005\11\13@202753 by Jon Williamsn/a

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

You're getting away with things in this program that you won't in some bigger programs -- what you should do is declare your subroutines.  This lets the subroutine exist anywhere in memory and lets the compiler do basic syntax check of your subs for you.

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

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

2005\11\13@212434 by kgraceyn/a

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

Jon,
I don't understand what you mean by declaring subroutines. Could you provide an example?

Thanks,
Ken Gracey
---------- End of Message ----------

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

2005\11\14@043034 by kd5dhun/a

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

On A windows PC:

Start>Programs>Parallax Inc>SX-Key v3.1>SX-Key v3.1

Menu Bar: Help>SX/B Help

SX/B Online Help>Reference>Definitions>Subroutine Declaration

:smilewinkgrin:

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

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

2005\11\14@044822 by Jon Williamsn/a

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

As of version 1.2 we have added the ability to declare a subroutine to the compiler; this helps the programmer in two ways:

1) Subroutines can exist anywhere in memory now
2) The compiler will check for the proper number of parameters.

In one of the posts above I showed a the subroutine code for TX_BYTE.  Here's how that's declared to the compiler:

TX_BYTE    SUB    1, 2
The "1, 2" section tells the compiler that this subroutine requires one parameter, and could take two.  So if you do something like this:

 TX_BYTE aVal, bVal, cVal
The compiler will flag it as too many parameters.  Notice too that I didn't need to use GOSUB -- this is optional with declared subroutines and saves a bit of typing.  Really, it's like adding your own commands.

For an example, have a look at this [early] version of the Serial Inkjet Printer drive code.

   http://forums.parallax.com/forums/attach.aspx?a=4029
You'll see a bunch of declared subroutines -- some with no parameters, so with mandatory and optional parameters.

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

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

2005\11\14@044947 by Jon Williamsn/a

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

As of version 1.2 we have added the ability to declare a subroutine to the compiler; this helps the programmer in two ways:

1) Subroutines can exist anywhere in memory now
2) The compiler will check for the proper number of parameters.

In one of the posts above I showed a the subroutine code for TX_BYTE.  Here's how that's declared to the compiler:

TX_BYTE    SUB    1, 2
The "1, 2" section tells the compiler that this subroutine requires one parameter, and could take two.  So if you do something like this:

 TX_BYTE aVal, bVal, cVal
The compiler will flag it as too many parameters.  Notice too that I didn't need to use GOSUB -- this is optional with declared subroutines and saves a bit of typing.  Really, it's like adding your own commands.

For an example, have a look at this [early] version of the Serial Inkjet Printer drive code.

   http://forums.parallax.com/forums/attach.aspx?a=4029
You'll see a bunch of declared subroutines -- some with no parameters, so with mandatory and optional parameters.

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

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

2005\11\14@051939 by tdg8934n/a

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

If you see in the new Revision B program (attached in my last post), I did declare my subroutines as John stated. However, I did not put in min and max parameter statements after the SUB listings.

When I try to enter them in I get an error message:


Error 10, Pass 1: Invalid Number of Parameters.


If I leave them out, it compiles fine.


(e.g.   SEROUTSXB SUB 1, 3) -- gets the error
(e.g.   SEROUTSXB SUB 3) --- gets the error
(e.g.   SEROUTSXB SUB) -- works fine.


Any guidance?


Thanks,

Timothy Gilmore

See Rev C, attached - which compiles fine.

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

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

2005\11\14@054107 by kd5dhun/a

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

[2]
Timothy,
Put this is your varables section of your program:

temp1    VAR     BYTE        ' subroutine work vars
Redefine your:

SEROUTSXB SUB
to:

SEROUTSXB SUB 1
Modify:

SEROUTSXB:
 SEROUT TxPin, Baud, char
 RETURN

to:

SEROUTSXB:
 temp1 = __PARAM1
 SEROUT TxPin, Baud, temp1
 RETURN

Now replace all of your:

GOSUB SEROUTSXB
With
SEROUTSXB 13        ' transmits a carrage return

It would be better to define carrage returns or whatever in your constants section like:

Cr    CON    13        ' ASCII Carrage Return
This way dou dont have to assign char before you call you SUB
If you look at some of Jon's examples, that use subroutines, you'll notice that he defines temp1 and others as work variables. These work varables get assigned by the __PARAMx Aliases, see "SX/B Online Help>Reference>Aliases>SX/B Variables"

Mike
[/2]
---------- End of Message ----------

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

2005\11\14@082240 by Jon Williamsn/a

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

Perhaps the attached program will help -- I took our BS2 demo for the Serial LCD and directly ported it to SX/B.  The demo shows how to declare subroutines (to maximize code space and flexibility) runs exactly like the BS2 version.  I don't have a backlit LCD so if someone will verify that the BL flashes at the end of the program I'd appreciate it.

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

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

2005\11\14@103840 by Jon Williamsn/a

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

Just for fun I wrote another version of LCD_OUT that works with a byte, string constant, or label (that points to DATA string).  Note that it does compile SEROUT twice, but I still think this is a decent routine to have in your bag:

' Use: LCD_OUT [ aByte | string | label ]
' -- "aByte" is single-byte constant or variable
' -- "string" is an embedded literal string
' -- "label" is DATA statement label for stored z-String
LCD_OUT:
 temp1 = __PARAM1                           ' byte or offset
 IF __PARAMCNT = 2 THEN                     ' string specified?
   temp2 = __PARAM2                         ' yes, save base
   DO
     READ temp2 + temp1, temp3              ' read a character
     IF temp3 = 0 THEN EXIT                 ' if 0, string complete
     SEROUT LcdTx, LcdBaud, temp3           ' send the byte
     INC temp1                              ' point to next character
     temp2 = temp2 + Z                      ' update base on overflow
   LOOP
 ELSE
   SEROUT LcdTx, LcdBaud, temp1             ' transmit to LCD
 ENDIF
 RETURN
---------- End of Message ----------

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

2005\11\14@104206 by tdg8934n/a

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

Wow...you guys have been earning your pay today!

Thanks for all the wonderfull insight to the SX/B and program code. I will look at all of it tonight and get reply back tomorrow or this evening.

Thanks again,

Timothy Gilmore
---------- End of Message ----------

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

2005\11\14@171934 by tdg8934n/a

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

I think I have this subroutine business figured out thanks to everyone especially Jon, John, Mike, Chris, Bean.

I have attached a more streamlined program LCD_Serial REV D (attached). I think this is as complete as I can get it for the time being and very happy with the results.

SERIAL LCD for the SX/B (SX28).

Thanks again,
Timothy Gilmore :turn:

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

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

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