Shop OBEX P1 Docs P2 Docs Learn Events
Mike Green's OS system — Parallax Forums

Mike Green's OS system

NewzedNewzed Posts: 2,503
edited 2007-08-01 14:47 in Propeller 1
For Mike Green:

After four days of effort, I finally got the Proto Board communicating with my 4x20 LCD.· The problem was with the line:

serialOut(6,c,stampBaud,sim#NInv,8)

I changed it from non-inverted to inverted and Bingo! - it worked.

Now I have another little problem.· I was to display the date/tine from a DS1302 in HEX2 format.· With the Stamp I write:

serout...HEX2 month, HEX2 date..etc.

and for the Prop I write:

text.hex(month,2) and so on.

The problem is, there is no way, using the simulation object, that I can send something like #07 as a byte.· Would you have time to write a
"sendhex'" method for simulation that would let me send the DS1302 parameters to the LCD in HEX2 format, so I could write something like:

sendhex(month,2)
·· hexOut(6,...(something).......stampBaud,sim#Inv,8)

If you don't have the time, that's OK.· I can mathematically manipulate the 1302 data so it goes to the LCD in the right format - it just takes a lot of time and uses quite a bit of memory.

Thanks

Sid


▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Yesterday is history, tomorrow is a mystery, and today is a gift.

That is why they call it the present.

Don't have VGA?
Newzed@aol.com
·

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2007-07-31 22:43
    Sid,
    I'm not sure where I saved a copy of the "simulation object". Please post a copy or a link to where I sent it to you and I'll have a look at it ... probably Thursday.
  • NewzedNewzed Posts: 2,503
    edited 2007-08-01 11:24
    Mike, here is a copy of the simulation object. Thanks a bunch.

    Sid

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Yesterday is history, tomorrow is a mystery, and today is a gift.

    That is why they call it the present.

    Don't have VGA?
    Newzed@aol.com
  • Mike GreenMike Green Posts: 23,101
    edited 2007-08-01 12:44
    Here's one routine for outputting variable width decimal (like DEC) and one for fixed width hex (like HEXn). These are just copied from the Propeller OS display routines and slightly modified to work with the serialOut routine here. I've not tried to compile them, but they look ok. Note that, just like the character output routine (which these use), they sandwich the "real" information (like the value to use) between the pin # and the Baud/mode/bits to be used. The "digits" parameter in the serialHex routine is the "n" in "HEXn" (the number of hex digits to output). Just stick these at the end of Simulation.spin.
    PUB serialDec(pin, value, Baud, mode, bits) | i       ' Transmit a decimal number
      if value < 0
        -value                                            ' Put out leading minus if negative
        serialOut(pin,"-",Baud,mode,bits)
      i := 1_000_000_000                                  ' Handle up to 10 significant digits
      repeat 10
        if value => i                                     ' Skip leading zeros
          serialOut(pin,value / i + "0",Baud,mode,bits)
          value //= i
          result~~                                        ' Indicate first significant digit
        elseif result or i == 1
          serialOut(pin,"0",Baud,mode,bits)               ' Always output at least one digit
        i /= 10
    
    PUB serialHex(pin, value, digits, Baud, mode, bits)   ' Transmit a hexadecimal number
      value <<= (8 - digits) << 2                         ' Position the value based on # digits
      repeat digits                                       ' Rotate and translate to hex chars
        serialOut(pin,lookupz((value<-=4)&$F:"0".."9","A".."F"),Baud,mode,bits)
    
    
  • NewzedNewzed Posts: 2,503
    edited 2007-08-01 14:47
    Mike, that works great - just what I wanted.· You save me 140 longs of memory.

    Sid

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Yesterday is history, tomorrow is a mystery, and today is a gift.

    That is why they call it the present.

    Don't have VGA?
    Newzed@aol.com
    ·
Sign In or Register to comment.