Help for a newbie on UBW and C

USB PICs and the UBW

Moderator: phalanx

Help for a newbie on UBW and C

Postby cjlectronics » Tue Dec 22, 2009 4:30 pm

I am new to the UBW but not new to electronics. I've coded in C but I'm rusty (been a while) and I have all of my old C books scattered all of my work bench.
We recently purchased a UBW with the PIC18F2553. I've read through the Quickstart guide and was successful in running the hyperterminal commands. I even was playing with the analog input, and my returned values from the PIC were much lower than my DMM. Not sure why and for now I'm happy that I am able to communicate to the development board and get something to work.

What I would like is some guidance on creating a simple C program that loads in address 0x00800 and flips a digital I/O bit at port b on and off at 1 second intervals. I have downloaded the D_143 code from http://www.schmalzhaus.com/UBW/ and read where modifying the user.c file is all that is necessary. BUT, that is way more than what I need right now. Can I just leave the bootloader code alone and write a simple program that loads at 0x800 and flips a bit on and off?

Is this possible?
Do I have to include the USB baggage with every program?
Do I need the USB baggage code if I want to monitor the bit toggle using hyperterminal?

I have many more questions but lets start here.

Thanks in advance,
CJ
cjlectronics
 
Posts: 2
Joined: Tue Dec 22, 2009 4:15 pm

Postby EmbeddedMan » Tue Dec 22, 2009 7:36 pm

Sure! I can't believe I didn't have a simple Hello World firmware example for the UBW.

So, I cooked on up for you. Here it is
http://schmalzhaus.com/UBW/FW/HelloWorld.zip

It doesn't get much simpler than that.

*Brian
User avatar
EmbeddedMan
 
Posts: 1362
Joined: Sun Mar 05, 2006 9:23 pm

Postby cjlectronics » Wed Dec 23, 2009 8:04 am

Awesome! That worked great!

I have a couple of questions:

1. What controls the location of my code when I download it from PDFSUSB.exe to the UBW?
2. Where do I find the definitions of the C syntax used in helloworld? Such as LATCbits.LATC0. I want to know what this does.

Thanks again Brian...I'm pumped!

CJ
cjlectronics
 
Posts: 2
Joined: Tue Dec 22, 2009 4:15 pm

Postby EmbeddedMan » Wed Dec 23, 2009 8:32 am

CJ,

1) The linker script file. (rm18f2455.lkr) There is a NAME=boot line that defines a reserved bootloader section. The NAME=page line is where the linker will put the main code.

2) All of those are in the standard C18 processor header files. The appropriate file is automagically included by the compiler (isn't it nice?). They are located in C:\MCC18\h and the one you want is p18f2455.h. (Yes, I know you have a 2553, but they are virtually identical and I didn't bother switching the project over. You can if you want.)

*Brian
User avatar
EmbeddedMan
 
Posts: 1362
Joined: Sun Mar 05, 2006 9:23 pm


Return to USB Development

Who is online

Users browsing this forum: No registered users and 0 guests