Shop OBEX P1 Docs P2 Docs Learn Events
Keyboard Demo — Parallax Forums

Keyboard Demo

dragonvetdragonvet Posts: 17
edited 2009-07-25 12:02 in Propeller 1
In the following;(Keyboard_Demo)
CON
······· _clkmode······· = xtal1 + pll16x
······· _xinfreq······· = 5_000_000

OBJ
······· term··· : "tv_terminal"
······· kb····· : "keyboard"

PUB start | i
· 'start the tv terminal
· term.start(12)
· term.str(string("Keyboard Demo...",13))
· 'start the keyboard
· kb.start(26, 27)
· 'echo keystrokes in hex
· repeat
··· term.hex(kb.getkey,3)
··· term.out(" ")
{{
I assume the numbers in parentheses are pin numbers...
when I try to change term to "FullDuplexSerial"
and change the pin number to another number I get an error message saying
expected··· ·","····· (·ie list delimiter)


my goal is to type a number string·on the keyboard and have it display on an LCD
(and also create a frequency in hertz matching that number)
thanks,
Rich

Comments

  • Peter JakackiPeter Jakacki Posts: 10,193
    edited 2009-07-24 02:51
    Different object with a method of the same name. Keyboard only requires the single parameter whereas the serial object requires 4 parameters. Always look at the object file to ascertain what it expects.

    *Peter*
  • CassLanCassLan Posts: 586
    edited 2009-07-24 02:54
    Hey Rich,
    I'm not really sure what your asking.
    Is your problem with the use of the Keyboard object or the FullDuplexSerial object -> LCD Display?
    What line of code is producing that error?

    If your trying to do a "drop-in" replacement of the tv_terminal object to the FullDuplexSerialObject, you have to make a couple of more changes to the program;

    While the tv_terminal object can be started with a tv_terminal.Start(basepin), the fullduplexserial object requires a bit more information to start the object (from the FullDuplexSerial Documentation):

    FullDuplexSerial.start(rxpin, txpin, mode, baudrate)

    Without going too much further, is the error being generated by the line:

    term.start(12)?

    (when changing the pin# also would apply)

    Rick

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔


    NYC Area Prop Club

    Prop Forum Search (Via Google)

    ·
  • dragonvetdragonvet Posts: 17
    edited 2009-07-24 11:02
    Thanks for replies,
    Yes, the problem was with the line
    term.start(12)
    so when setting those 4 parameters rx and tx are obvious for me and I know where and what numbers to call the baud rate , my next question is what and/or how do you determine mode and what value to apply for it? Just plugging a number in at that spot gets me farther than before ( in terms of no error ) but I'd like to know how that value is determined. Also, how do you know what baud rate is appropriate for baud rate value?
    Thanks,
    Rich
  • MagIO2MagIO2 Posts: 2,243
    edited 2009-07-24 12:42
    You should have closer looks into the object code that you use. Normally in the object header it's explained in detail how the object can be used. As far as I remember you can select inverting or non inverting TX / RX and open collector TX by setting appropriate mode bits.

    There are no fixed values for the baudrate - only an upper-limit - in the FullDuplexSerial ... I believe. Dunno what the limit is, but ~100k should work. The thing with the baudrate is - you have to use the same on both sides. So, have a look at your terminal SW on PC side, check what baudrate it offers and use the same for the FullDuplex - of course up to the limit.
  • CassLanCassLan Posts: 586
    edited 2009-07-24 13:16
    dragonvet said...
    Yes, the problem was with the line
    term.start(12)
    so when setting those 4 parameters rx and tx are obvious for me and I know where and what numbers to call the baud rate , my next question is what and/or how do you determine mode and what value to apply for it? Just plugging a number in at that spot gets me farther than before ( in terms of no error ) but I'd like to know how that value is determined. Also, how do you know what baud rate is appropriate for baud rate value?
    Thanks,
    Rich
    The mode and Baudrate will depend on what your trying to communicate with. What kind of LCD are you hooking up to?

    As far as what the values of the mode could be...you need to open the object your trying to use...and click the Documentation option on the right. I have attached a screebshot which should help explain this.

    Rick

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔


    NYC Area Prop Club

    Prop Forum Search (Via Google)



    Post Edited (CassLan) : 7/24/2009 1:33:54 PM GMT
    1176 x 687 - 66K
  • dragonvetdragonvet Posts: 17
    edited 2009-07-25 10:33
    Thanks,
    Yes I found where the mode value options are , I just didn't know how you determined which one to pick . It is a 2x16 serial LCD non back li part #27976. Do you look at the datasheet for htis part?
    thanks again ,
    Rich
  • Peter JakackiPeter Jakacki Posts: 10,193
    edited 2009-07-25 12:02
    Rich, you should have all the info at your fingertips so there is no guessing. However, depending upon what you have the lcd set to it could be 2400, 9600, or 19200 baud. Set the mode to 0 normally or 3 if you are dealing with "inverted" logic. I can't tell from the datasheet which way round it is but 0 is probably the default.

    Once again, everybody is telling you to look at the Spin file for the object, it's like the datasheet for the lcd, it tell's you all about it.

    *Peter*
Sign In or Register to comment.