Announcement

Collapse
No announcement yet.

uLCD 32PT GPIO bug for SPI and 1 Wire

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • pauleilio
    replied
    Hi Mark,

    You code looks right so I don't think it is a function that is causing the 10 degrees higher. there have been reports of reading higher but not as much as 10 degrees. Are they Dallas sensors ?
    You could try printing out the MSB and LSB to make sure that the LSB is changing as expected.

    Best regards

    Paul

    Leave a comment:


  • markl
    replied
    Well, I thought I had this project done, but the readings that I’m getting are about 10 degrees too high. I have tried changing the sensors but the result is the same. Do you know what could be going on here ? I’m not talking about conversion error to Fahrenheit, I’m talking about the Celsius value that’s reported. Is there some function that could be influencing the result? Any help would be appreciated.
    regards,
    Mark

    Leave a comment:


  • markl
    replied
    thanks again, that does what I needed

    Leave a comment:


  • pauleilio
    replied
    Hi Mark,

    You could use the system rolling timer sys_T() like this

    in Constant/Globals/Data,

    var timeNow;

    in PostGenieInit

    timeNow := sys_T();

    and in your Mainloop

    if((sys_T() - timeNow) > 3000) // 3000 milliseconds
    txt_MoveCursor(1, 0);
    print (GetOneWire());
    timeNow := sys_T();
    endif

    I hope this helps

    Best regards

    Paul

    Leave a comment:


  • markl
    replied
    Paul,
    Thanks again, that seems to work fine. I did have another question. If I want the temp checked every few seconds instead of every time through the loop, how would you do it?

    Thanks for your help,

    Mark

    Leave a comment:


  • pauleilio
    replied
    Hi Mark,

    I think it is this bit of code that will cause it to block your program.

    if(OW_Reset(PA2)) // initialise and test
    print("No device detected");
    while(1);
    endif

    You could just use

    var deviceOk;
    if(OW_Reset(PA2)) deviceOk := 1;

    Or you could remove that completely as a reset is called within a print statement.

    Another way you could do this is to put the code in a function with an insertion point Globals/Data eg

    func GetOneWire()

    OW_Reset(PA2);
    OW_Write(PA2, 0xcc); // skip ROM
    OW_Write(PA2, 0x44); // start conversion
    OW_Reset(PA2); // reset
    OW_Write(PA2, 0xcc); // skip ROM
    OW_Write(PA2, 0xBE); // get temperature
    temp_buf := OW_Read(PA2);
    temp_buf += (OW_Read(PA2) << 8);

    return temp_buf;

    endfunc

    You can then use this function in you mainloop code eg,

    txt_MoveCursor(1, 0);
    print (GetOneWire());

    I hope this helps

    Best regards

    Paul






    Leave a comment:


  • markl
    replied
    Thank you pauleilio for your reply. I found this bit of code that works fine on its own but locks up my Visi-Genie code when I try to use it as a separate function:


    var temp_buf ;

    txt_MoveCursor(0,0);
    if(OW_Reset(PA2)) // initialise and test
    print("No device detected");
    while(1);
    endif
    // repeat
    txt_MoveCursor(0, 0);
    print ("result=", OW_Reset(PA2));
    OW_Write(PA2, 0xcc); // skip ROM
    OW_Write(PA2, 0x44); // start conversion
    OW_Reset(PA2); // reset
    OW_Write(PA2, 0xcc); // skip ROM
    OW_Write(PA2, 0xBE); // get temperature
    temp_buf := OW_Read(PA2);
    temp_buf += (OW_Read(PA2) << 8);
    txt_MoveCursor(1, 0);
    print ("temp_buf=0x", [DEC4] temp_buf);
    // forever

    I know that if I have a function that repeats "forever" in the main loop that it will slow everything down, so I took the repeat and forever out. However what happens is that it reads the temp once and blocks my other functions. It doesn't lock the screen up, but it stops every other sensor from displaying. Where can I insert this in the visi genie code so it will not affect everything else?
    I was connecting it to an Arduino, but it was slowing everything down there as well. I have code that only asks it to update once per second, but that didn't help either.
    Any ideas?

    Thanks for your help,

    Mark

    Leave a comment:


  • pauleilio
    replied
    Hello Mark,

    The example was written for a Picaso, 1 Wire functions are already present in the PmmC of your device. You need to remove #include for the 1-Wire library and also set it up to use PA pin numbers for a Diablo instead of IO numbers eg PA5 instead of IO5 etc.page 49 onwards of this datasheet may help with pin numbers.

    https://www.4dsystems.com.au/product...ions_R_2_0.pdf

    Best regards

    Paul

    Leave a comment:


  • markl
    replied
    Hi Guys,

    I am trying to connect a one-wire temp sensor DS18B20 directly to a "Gen4-uLCD-43DCT-CLB". The code is from the app note: 4D-AN-P3006. When I try to compile it, these are the error messages that I get:

    Error: name 'OW_Reset' is already used as a 'PmmC function' in line 4936 (line 26 file:1-Wire-TEMP.inc)
    Error: name 'OW_Write' is already used as a 'PmmC function' in line 4962 (line 50 file:1-Wire-TEMP.inc)
    Error: name 'OW_Read' is already used as a 'PmmC function' in line 4944 (line 78 file:1-Wire-TEMP.inc)
    Error: undefined symbol 'IO5_PIN' (line 38 column 18 file:1-Wire-Discovery.4dg)
    Error: could not resolve a integer value for constant OW_PIN (line 39 file:1-Wire-Discovery.4dg)
    Fatal error: errors in first pass(1), can't continue (line 151 file:1-Wire-Discovery.4dg)

    I would appreciate any help to get this running.

    Thank you,

    Mark

    Leave a comment:


  • Enigma
    replied


    @muth

    I just came across this thread. I'm interested in using the spi which on the uLCD-32PT only goes to the Micro SD card.

    I think it would be posssible to tap into those lines and run back to the expansion board. They do it on the uLCD-3202 board.

    I'm going to try since I need the SPI interface in a project of mine and I don't want to use a PIC which is just more hardware to worry about.

    Did you try yet?

    Regards

    Eric

    Leave a comment:


  • bisnouk
    replied


    Thanks for all these replies, and thanks for the R22 release.

    Leave a comment:


  • muth
    replied


    No problem meldavia

    Leave a comment:


  • meldavia
    replied


    My apologies, what I said above about r21 is incorrect. The problem exists in r20 and r21, r22 will have the correct behaviour.

    Leave a comment:


  • muth
    replied


    Many thanks meldavia and Atilla for the reply, I'm very pleased to have a feed back.

    I'm quiet sure to had uploaded the r21 pmmc version, but I did not realize that parameters of pin_Set could be inverted, that explain lot of things. Thanks a lot for the bug explanation !

    Is it conceivable to add, like bisnouk suggested, a code sharing section in the forum ? (near the Anna's sandbox probably)

    Is a section with, on going work or improvement for pmmc, list of bug found, explained and possible work around, exist ?

    Of course I can easily imagine the work load represented by managing a forum in addition of the technical work on your products. I would like to thank you for the time taken to reply me, and the continuous work on those devices.

    I'm patiently looking forward the r22

    PS: bisnouk: I'll make a tiny web page with my project, I'll mail you when I put online.

    Leave a comment:


  • meldavia
    replied


    A follow up on that bug, the parameters to function pin_Set(direction, pin); were inadvertently transposed in PmmC r20. This has been fixed for r21.

    a temporary workaround would be to transpose the parameters for pin_Set eg:

    pin_Set(IO2_PIN, OUTPUT);

    Leave a comment:

Working...
X