UBW32 basic Commands

Thread Starter

RoboticFan87

Joined Sep 12, 2009
38
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
 

Thread Starter

RoboticFan87

Joined Sep 12, 2009
38
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?
 

BMorse

Joined Sep 26, 2009
2,675
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?
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....
 

Thread Starter

RoboticFan87

Joined Sep 12, 2009
38
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
 

BMorse

Joined Sep 26, 2009
2,675
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
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.
 

Thread Starter

RoboticFan87

Joined Sep 12, 2009
38
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?

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
 

Thread Starter

RoboticFan87

Joined Sep 12, 2009
38
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
 

BMorse

Joined Sep 26, 2009
2,675
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:

BMorse

Joined Sep 26, 2009
2,675
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:
Rich (BB code):
#include "I2C.h"
to the MAIN.c file and the D32.c file....

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

I hope this helps.....
 

Attachments

Last edited:
Top