1. Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.
    Dismiss Notice

URM37 V3.2 with OSHON.

Discussion in 'Oshonsoft' started by SwingeyP, Apr 5, 2012.

  1. ericgibbs

    ericgibbs Well-Known Member Most Helpful Member

    Joined:
    Jan 4, 2007
    Messages:
    21,189
    Likes:
    644
    Location:
    Ex Yorks' Hants UK
    hi Paul,
    Try this program in your PIC to URM, I have added some delays to the Hserout subs.

    Remove the .txt extension from the file
     
  2. SwingeyP

    SwingeyP Member

    Joined:
    Apr 26, 2010
    Messages:
    292
    Likes:
    2
    Location:
    Birmingham UK
    Hi Eric.

    After much hair ripping and shouting I decided to double check everything. This is when I realised I had made a 'take it for granted' mistake. Earlier I was convinced that the PIC just wasn't transmitting. I checked with the logic probe and sure enough a pulse on pin 8. What I now realise is that I didn't check the other end. It turns out that the ZIF socket I have has a bad connection on that pin. Aggghhhhh!

    So I now have comms back to the PC terminal from the pic. I have disconnected the URM and now emulate this with the PC. Upon switch on I would expect to see

    00 00 00 00 - Set mode
    11 00 00 11 - SendCommandTemp

    However the PC terminal report :

    80 80 80 80 91 80 80 c4 (extra space to make it easier to read)

    Any ideas? - Maybe this IS a timing issue now.

    Regards - Paul
     
  3. ericgibbs

    ericgibbs Well-Known Member Most Helpful Member

    Joined:
    Jan 4, 2007
    Messages:
    21,189
    Likes:
    644
    Location:
    Ex Yorks' Hants UK
    hi Paul,
    I assume that the PC's UART is set for 1start bit, 8 data bits and 1 stop bit, no parity.???

    Usually: 9600,n,8,1
     
  4. dave

    Dave New Member

    Joined:
    Jan 12, 1997
    Messages:
    -
    Likes:
    0


     
  5. SwingeyP

    SwingeyP Member

    Joined:
    Apr 26, 2010
    Messages:
    292
    Likes:
    2
    Location:
    Birmingham UK

    Yes it is ....
     
  6. ericgibbs

    ericgibbs Well-Known Member Most Helpful Member

    Joined:
    Jan 4, 2007
    Messages:
    21,189
    Likes:
    644
    Location:
    Ex Yorks' Hants UK
    hi,
    It looks as though its adding Bit 7 to each Byte.??

    With your test meter, when the PIC is NOT transmitting, just Idle, the TX pin of the MAX232 connected to the PC input should be at a minus voltage.??

    Can you check it.?
     
    Last edited: Apr 9, 2012
  7. SwingeyP

    SwingeyP Member

    Joined:
    Apr 26, 2010
    Messages:
    292
    Likes:
    2
    Location:
    Birmingham UK
    Ok Eric -7v
     
  8. ericgibbs

    ericgibbs Well-Known Member Most Helpful Member

    Joined:
    Jan 4, 2007
    Messages:
    21,189
    Likes:
    644
    Location:
    Ex Yorks' Hants UK
    Hi,
    I will set up here what you have. I will use a 16F877 PIC , I dont have a 16F648 .

    ie: Programmed PIC to PC as a URM emulator, will let you know what I see.

    Which PC program are you using to emulate the URM.?

    For ref , the CONFIG you have set is for LVP ON, No PWRON delay, Brown Out enabled.???
     
    Last edited: Apr 9, 2012
  9. ericgibbs

    ericgibbs Well-Known Member Most Helpful Member

    Joined:
    Jan 4, 2007
    Messages:
    21,189
    Likes:
    644
    Location:
    Ex Yorks' Hants UK
    hi Paul,
    Programmed a 16F877 with a modified version of your Basic program. it just loops every 500mSec to send 11h,00h,00h,11h and then 22h, 00h, 00h 22h [ no commas].

    Look at the RS232 print out on this image.

    I will program a second PC as a URM emulator.

    E.

    Note: the full stops between Bytes is only on the display so its easier to read
     
    Last edited: Apr 9, 2012
  10. SwingeyP

    SwingeyP Member

    Joined:
    Apr 26, 2010
    Messages:
    292
    Likes:
    2
    Location:
    Birmingham UK
    I use the OSHON PC Serial Port Terminal for emulation. The config I ignore and set everything to off in the MPLAB burner.
     
  11. ericgibbs

    ericgibbs Well-Known Member Most Helpful Member

    Joined:
    Jan 4, 2007
    Messages:
    21,189
    Likes:
    644
    Location:
    Ex Yorks' Hants UK
    Using the Oshonsoft PC port I get this.

    OK.
     
  12. SwingeyP

    SwingeyP Member

    Joined:
    Apr 26, 2010
    Messages:
    292
    Likes:
    2
    Location:
    Birmingham UK
    Just about to rewrite with a loop sending 11 00 00 11 etc ...
     
  13. ericgibbs

    ericgibbs Well-Known Member Most Helpful Member

    Joined:
    Jan 4, 2007
    Messages:
    21,189
    Likes:
    644
    Location:
    Ex Yorks' Hants UK
    hi,
    This is with the Tempr looping.
    The Violet coloured text is the URM response,,, it displays on the LCD ok as 1.0C degree
     
  14. SwingeyP

    SwingeyP Member

    Joined:
    Apr 26, 2010
    Messages:
    292
    Likes:
    2
    Location:
    Birmingham UK
    Hi Eric,

    Well I made this video .....

    http://www.youtube.com/watch?v=nfFpqQ2N3Ss

    I decided to change the MAX232 and see what happens. It's the only thing I haven't tried yet. I have tried several PIC's.

    Having changed the MAX 232 I do get what I would expect MOST of the time. Sometimes it throws a wobbly and sends incorrect data.
     
  15. SwingeyP

    SwingeyP Member

    Joined:
    Apr 26, 2010
    Messages:
    292
    Likes:
    2
    Location:
    Birmingham UK
    OK so it's not CODE. This is some weird electronics thing I think.

    I'm going to break it all down and start again electronically. My development peg board has seen better days and I hate those thin wires ....

    Regards - Paul
     
  16. SwingeyP

    SwingeyP Member

    Joined:
    Apr 26, 2010
    Messages:
    292
    Likes:
    2
    Location:
    Birmingham UK
    Nothing to do with changing the MAX232. :-( as expected. The problem still remains .......

    I feel you may be receiving a package in the post Eric.

    Many thanks for all your help with this.

    Regards - Paul
     
  17. SwingeyP

    SwingeyP Member

    Joined:
    Apr 26, 2010
    Messages:
    292
    Likes:
    2
    Location:
    Birmingham UK
    WOO HOO cracked it ....! (Well the first bit anyway ....

    The URM 37 was connected to the same 5v ov lines as the RS232 / TTL. Disconnected it and 11 00 00 11 22 00 00 22 etc.....

    Why this should be I have no idea. Im off to find anothe PSU now ....
     
  18. ericgibbs

    ericgibbs Well-Known Member Most Helpful Member

    Joined:
    Jan 4, 2007
    Messages:
    21,189
    Likes:
    644
    Location:
    Ex Yorks' Hants UK
    hi Paul,
    Be sure to have good shared 0V connection to all the devices, PC, URM and PIC.

    E
     
  19. SwingeyP

    SwingeyP Member

    Joined:
    Apr 26, 2010
    Messages:
    292
    Likes:
    2
    Location:
    Birmingham UK
    Hi Eric,

    I have uploaded another video so you can see what's happening.

    http://www.youtube.com/watch?v=xPGj...DvjVQa1PpcFM-SqdCb6h8tKumdV0h-GTvHpKxrHBnVMw=

    I can now emulate the URM with the PC properly and see the proper commands coming back from the pic.
    I can also just connect the URM and emulate the pic from the PC.

    Connecting it all together is a no go. For some reason when ever I connect the URM the commands from the pic get corrupted. - Possible noise? - but this is even witout the data lines connected.

    I tried a seperate PSU and commoned all the 0v and still the same probem.

    Progress IS being made although slowly. At least now I know my (our) code works ...... ;-)

    Regards - Paul
     
  20. ericgibbs

    ericgibbs Well-Known Member Most Helpful Member

    Joined:
    Jan 4, 2007
    Messages:
    21,189
    Likes:
    644
    Location:
    Ex Yorks' Hants UK
    hi Paul,
    Watched that vid a number times, its strange why just powering the URM without any other lines should effect the RS232 data.??

    I cannot see from the vid, but are you sure that those two end pins on the URM are the power and not the RS232.??

    Do you have decoupling capacitors on the Bread board power rails.?

    E

    EDIT:
    I dont see any decoupling caps on the BB.??
     
    Last edited: Apr 9, 2012
  21. ericgibbs

    ericgibbs Well-Known Member Most Helpful Member

    Joined:
    Jan 4, 2007
    Messages:
    21,189
    Likes:
    644
    Location:
    Ex Yorks' Hants UK
    hi Paul,
    Install the Visual Basic 5 runtime files [ free on the web]

    You can then use the CmdComm1.exe [it emulates the URM] in place of the Oshonsoft PC Uart program, its a a lot easier to use.

    The swingy1c.bas is a modified version of your original basic program.

    It will accept Tempr and Distance commands in any order. [your original program had to be Tempr > Dist > Tempr > ...]

    Its also possible to Inc/Dec the Tempr/Dist values from the URM.

    E.

    Use the UART option to select the Comm port your PC uses.
     
    Last edited: Apr 13, 2012

Share This Page