UBW32 basic Commands

Discussion in 'Embedded Systems and Microcontrollers' started by RoboticFan87, Oct 20, 2009.

  1. RoboticFan87

    Thread Starter Member

    Sep 12, 2009
    38
    0
    Hey all,

    Did anybody here used UBW32 before? If so, do you know what commands i should use to let the board accept inputs from my keyboard and send them to a defined I/O port?

    Thanks in advance
     
  2. russ_hensel

    Well-Known Member

    Jan 11, 2009
    818
    47
    I have used it, but do not think I understand the question. What is the keyboard connected to?
     
  3. BMorse

    Senior Member

    Sep 26, 2009
    2,675
    234
    I have played around with that module quite a bit....

    here is the command listing>> http://www.schmalzhaus.com/UBW32/doc/UBW32Documentation_v10.html

    You have to have your ubw32 connected to a PC with a Terminal Program Running such as Hyper Terminal or similar, from there you can access the command line for the UBW32....
     
  4. RoboticFan87

    Thread Starter Member

    Sep 12, 2009
    38
    0
    well basically the UBW32 is connect to the PC through the USB, all i want to do is program the UBW in a way it asks me for certain standard user input, then it takes that and sends it to another chip connected through one of its I/O port...does that make any sense?
     
  5. BMorse

    Senior Member

    Sep 26, 2009
    2,675
    234
    How are you planning on supplying input to the UBW32? From PC? or from something else that would be connected to the UBW32?

    When I played around with that module I got rid of all the D32 code that came with it (Left the bootloader intact) and just wrote my own program in MPLAB with C.

    The amount of programming you can do for the UBW32 with its preloaded code has limited functionality....
     
  6. RoboticFan87

    Thread Starter Member

    Sep 12, 2009
    38
    0
    Yes im planning to supply the input through the pc.

    Example:
    UBW32 outputs something like a cout to the terminal window
    ex: "What is the file ID you are looking for?"
    the user then enters the ID number whatever it is
    ex:"5463215" it acts as a cin
    then UBW32 takes that cin and sends it to the control chip that is connected to one of the I/O ports..

    I hope it makes sense now...Im a newbie with this and i really appreciate your help :)
    Thanks
     
  7. BMorse

    Senior Member

    Sep 26, 2009
    2,675
    234
    Unfortunately you will not be able to do this with the terminal interface with the UBW32 (the terminal interface only lets you set ports as outputs or inputs, and reading port values, really basic on/off stuff, no string values can be passed...), you will have to write something in c and download it via the USB bootloader ( I have done this plenty of times while testing the module).

    You can still write the program to use the terminal, you will just have to modify some of the code to pass string values, and tailor it to suit your needs.

    I have a few more questions :

    1. what connection is the control chip using to the UBW32? (i.e. I2C, SPI, etc.) (You will have to set up this peripheral for you to use it and you can't do that through the standard UBW32 code without modifying it.)
    2. Do you have a C compiler you can alter the code in?
    3. Have you written in C, or used Microchip's C Compiler in MPLAB?
    I just needed to know, so I know how else to help if I can, and I hate assuming, so might as well ask.
     
  8. RoboticFan87

    Thread Starter Member

    Sep 12, 2009
    38
    0

    1) The control chip will use the I2C connection to the UBW32
    2)The only C compiler that i have access to is MPLAB
    3)I never used MPLAB before, i have wrote C code but this is my first time programming a microcontroller.

    If there is any sample programs that i can use that will be appreciated. And thanks for helping me out :D
     
  9. BMorse

    Senior Member

    Sep 26, 2009
    2,675
    234
    Ok, at least we can work with the same tools, in case we have to, but for sample code I find most of them here for the 32 bit PIC uc's...http://www.microchip.com/stellent/idcplg?IdcService=SS_GET_PAGE&nodeId=2609, check out the general purpose ones for I2C... What control IC is it? Maybe it might be something I have worked with before and already have C code for it.....
     
  10. RoboticFan87

    Thread Starter Member

    Sep 12, 2009
    38
    0
    We are going to use DS2482S-800 as our control chip connected to a I2C peripheral in the PIC dev. board.
    So basically my PIC program all it does is get user inputs from the PC and transmit it to the control chip and reply back to PC thats all.
    And i can use the cmd or the HyperTerminal to input and output the commands/results

    Thanks
     
  11. BMorse

    Senior Member

    Sep 26, 2009
    2,675
    234
    That should be easy easy enough to implement, you can download the current source for the UBW32 here >> http://www.schmalzhaus.com/UBW32/doc/UBW32Documentation_v1_3.html

    Just modify D32.c, and Main.c to suit your needs.... read through D32.c so you can see how they are polling the USB and how you can integrate that into your app to control an I2C bus as master or slave....
     
  12. RoboticFan87

    Thread Starter Member

    Sep 12, 2009
    38
    0
    Thx buddy :D
     
  13. RoboticFan87

    Thread Starter Member

    Sep 12, 2009
    38
    0
    hey,
    Do you know how i can set the I2C peripheral using the D32.c?
     
  14. BMorse

    Senior Member

    Sep 26, 2009
    2,675
    234
    I will check that out for you when I get home tonight........

    On the other hand you should be able to write a c file for the I2C, just initialize the I2C via the startup code in D32.c, but I will look into it for you. I tried using Microchips sample code once on the I2C and never did get it to work properly but I have written my own I2C code for reading and writing to the I2C port and it works quite well (I used it to communicate with an MPR084Q Touch pad controller), I will clean it up a bit and you can use any of it if you would like.
     
    Last edited: Oct 28, 2009
  15. BMorse

    Senior Member

    Sep 26, 2009
    2,675
    234
    I went through and cleaned up my I2C code a bit so you can take a look at it and modify it to your needs, I have the I2C port set at 7 bit addressing in I2C.c you can edit these settings to match the settings you need in the Init_I2C function.....

    Now for the D32.C file......

    The D32.c file is for parsing and running the commands sent from the terminal app on the PC... so the easy way to do this is to just add I2C.c and I2C.h to your project, this way you can just link to the I2C.h file by adding:
    Code ( (Unknown Language)):
    1. #include "I2C.h"
    to the MAIN.c file and the D32.c file....

    then from the MAIN.c file in the
    Code ( (Unknown Language)):
    1. static void InitializeSystem(void)
    function add
    Code ( (Unknown Language)):
    1. Init_I2C();
    right above
    Code ( (Unknown Language)):
    1. UserInit();
    2.  
    then in the D32.c file in the
    Code ( (Unknown Language)):
    1. parse_packet ();
    function, you can add your own code to send or receive your data to the I2C device.....

    I hope this helps.....
     
    • I2C.zip
      File size:
      1.8 KB
      Views:
      10
    Last edited: Oct 28, 2009
  16. RoboticFan87

    Thread Starter Member

    Sep 12, 2009
    38
    0
    Thanks alot buddy, I learned alot from ya :D Appreciate it

    Mido
     
Loading...