Shop OBEX P1 Docs P2 Docs Learn Events
Changing Variables Is it changing.....or isn't it? — Parallax Forums

Changing Variables Is it changing.....or isn't it?

James LongJames Long Posts: 1,181
edited 2007-02-23 20:47 in Propeller 1
Ok....so I'm trying to update a display....and I'm having a bit of trouble.
The system seems to never update the numerical value. I'm going to post code here. I thought some one may suggest the reason it's not working.

The following code is all within a repeating loop.
Should this not update the display everytime is loops.....or will it only update it once?

Information.......· serial (fullduplexserial)······ ·delay(timing)···· ·bs2(bs2_functions)··num(numbers)·· ·goodcht1 (word variable)

Any help would be nice,
· goodcht1 := 0·
· outa[noparse][[/noparse]8] := 0
· goodcht1 := bs2.shiftin(12,11,bs2#msbpre,16)
· outa[noparse][[/noparse]8] := 1

· if goodcht1 > 4·
··· setcolor(green)
· else
··· setcolor(red)

· setloc(133, 90)
· font(regular)
· goodcht1 := goodcht1 >> 3
· serial.tx(print_string)
· serial.str(num.tostr(goodcht1, num#dec))
· serial.tx(0)
James L

·

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2007-02-23 04:46
    There's a lot of stuff you're listing, but not describing ... setcolor(), setloc(), font(), print_string. I don't know what they do. Maybe they're important. What kind of display are you using?

    FullDuplexSerial is a buffered serial driver. It can hold 15 bytes of info to transmit so you can go through several loops without seeing anything at the other end of the serial line. If the transmitted data is at one Baud and the display is expecting another, nothing will show. Is other information being displayed properly?
  • James LongJames Long Posts: 1,181
    edited 2007-02-23 04:55
    Mike,

    I'm using the Ezlcd 004.

    The other commands are dealing with the display itself....and everything else is working fine. I would upload the whole file...but it is quite big...and has a lot with no association with this variable.

    There is a huge amount of information before and after this variable that works correctly....and I'm not sure why this variable doesn't seem to change.

    I've had quite a few problems with this board (yea I designed it...but had nothing but problems) but I have oscoped the comm pins and see information. Although my scope is not good enough to see the exact info. (It's not fast enough to figure the binary number).

    James L
  • Mike GreenMike Green Posts: 23,101
    edited 2007-02-23 05:49
    James,
    I don't see any obvious reason why this wouldn't work. It may be that you're not receiving different data. One way to check would be to comment out the first 4 lines you posted (where the value is read in) and substitute "goodcht1++". You'd quickly see if the problem is in the display output or the data input.
  • James LongJames Long Posts: 1,181
    edited 2007-02-23 06:27
    Mike,

    Good thinking.....and the display does show the value increasing when using the post increment operator.

    I had to take out the shift right ...but the display works well....

    Thanks for the idea.....but the problem must be getting the value from the MAX 6675.

    This project has been a nightmare from the start. I took on too big of a project at once. But it has been a challenge.

    So now to figure out why the MAX 6675 isn't updating. Hmmmmmm

    Thanks Mike,

    James L
  • Martin HebelMartin Hebel Posts: 1,239
    edited 2007-02-23 06:32
    James,
    Though you didn't post all your code, are you starting the BS2 object - BS2.Start(31,30)? It's often missed and prevent its from timing correctly.
    -Martin
    ·
  • James LongJames Long Posts: 1,181
    edited 2007-02-23 06:41
    Martin,

    No actually I haven't started the BS2 with the start command....but I don't think it would affect the Shiftin command.

    The shiftin command uses waitcnt.....so the timing of the rest of the functions are not important...since I'm not using them. I'm not using the debug....so I don't think that is a problem....but thanks for the advice.

    This is a hack to try and find the problems.....I'll not use the BS2 function object in the final code....just using it to insure I'm not making coding mistakes.

    I'm also not starting other cogs.....other than the fullduplex serial at this point....I just want to see all the chips talk correctly first...then I'll break it up into mulitple cogs.

    James L
  • bambinobambino Posts: 789
    edited 2007-02-23 15:55
    James,
    I was loking at this[noparse]:http:[/noparse]//www.codemercs.com/Downloads/AN4.pdf
    And it accured to me that useing the Bs2 funtions might be a little tricky to get a result from on a good day. Maybe you should go ahead and write you SPI engine and try talking with it. The BS2.Shiftin isn't asyncrones.
  • James LongJames Long Posts: 1,181
    edited 2007-02-23 18:48
    I don't know what is going on. I know the numbers I'm getting are consistantly the same. I'm just not sure why I'm getting any numbers.

    I have written Maxim.....to see if they can explain why I'm getting a value from the MAX6675 with no thermocouple connected.

    I'm also sure that the 6675's are giving a value.....but still.....I'm not sure why. My scope shows the value....but it's impossible to read....because my scope just isn't fast enough.

    I'll look at the listed PDF file and see if I can discern what the problem is.

    thanks for all the help so far....I will find the problem....just don't know when.

    EDIT ...I think I have just found the problem.....the conversion time of the MAX6675 is much longer than I had previously thought. (I missed this information in the datasheet). This may be causing invalid information to be sent from the MAX 6675. Bambino helped with the PDF file....because it mentioned the conversion time to be .17 sec. I'm interogating the 6675 much faster than that. So ....I'll put in a time delay. I'll let everyone know. /EDIT

    James L


    Post Edited (James Long) : 2/23/2007 7:00:09 PM GMT
  • James LongJames Long Posts: 1,181
    edited 2007-02-23 20:47
    Ok...all...jsut as a quick update....the BS2 function library works flawlessly......the problem was the interogation time of the chip.....I was intergoating the chips so fast, it didn't have time to finish a conversion. I don't know why the chip gives a temperature all the time (may be the internal compensation) but the system works well. I connected a thermocouple and put it in an oven at 350 F and the temperature read back was about 180C. That is pretty close. I watched the temp rise and fall.

    That solved the biggest problem I have had so far.....I must start paying closer attention to the time restraints of the chips I'm dealing with. The time required for the MAX 6675 is .17 secs or 170ms.

    BTw anyone using the EzLCD....this thing works great. Although I haven't started with touch yet...the display is rock solid.

    Thanks to all who helped....it will be a nice system once finished.

    James L
Sign In or Register to comment.