Continue to Site

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.

  • 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.

18F4550 project

Status
Not open for further replies.

superbrew

Member
Hello, I am in the beginning phase of my design project for my ASEE and would like to know if it is possible to do what I want. I am designing a system that will monitor 2 or 3 parameters in my car such as turbo boost, EGT, oil pressure, etc. The sytem will dislpay readings on a GLCD. This part is not that hard, but, I would also like it to be able to log data to an EEPROM and download to a PC via USB. Is it possible to have a device that will act as a monitoring system in the car and as a USB device when attached to the PC? Should I use the MSD fw from Microchip or something else like the UBW?
 
Hi,

Yes, its all very do-able, the EEprom could be on the pic chip or a low cost external eeprom chip on either a I2c or SPI connection.

You need a chip like the 18F2550 or 18F4550, which are set up for USB comms - see the large section of free USB firmware at Microchips site.
All the code is in C which is a problem if you code in Assembler ?
 
Thanks, I am trying to wade through the vast amount of information on Microchip's website now. I am having a little trouble in figuring out where to start. I have tried most of the examples for the 18F's in the USB framework, and have modified some to do various things, but the code is too much for me to follow at this point. I am studying **broken link removed** code now to see what I can do with it.
 
I managed to get the MSD code to work and ended up with a 4kB USB drive. One version of the code uses an SPI EEPROM as the storage medium and this would allow you a couple of Mb of storage. When not connected to a PC your code can access the EEPROM as long as you incorporate the FAT16 code as well. Like you, I found the Microchip code to be rather hard to follow but this may be USB code in general.

Mike.
 
superbrew good luck on your project... Microchips Stuff is complex only because USB is complex :D

I would recommend you download "MCHPFSUSB Framework v2.3 " be sure to read through the comments in the projects. It seems like alot of code but most of it is comments. Which is great for understanding whats done and when its going to happen. Its bad for read-ability tho :(

Just try your best and if ya need help most of us would be glad to help.

Pommie i just did that MSD thing "USB Device - Mass Storage - Internal Flash" from the framework. Its Awsome! makes me want to learn more! So far im understanding it more than i would have thought.
 
Alright, I have made some progress. I have modified the software so that when I press a button on PORTC, I take 128 readings of the ADC and store them in an array. Then I can use a modified version of the PC software form the piccoder website and display them in a list.
I then tried adding a GLCD, and the transfer to the PC is not working. The GLCD data lines are PORTD, and the control line are PORTB 0-5. The GLCD is working properly.
How would I determine if the USB is working properly? Is this the line that determines that:
Code:
if((usb_device_state < CONFIGURED_STATE)||(UCONbits.SUSPND==1)) 
{
        //I have tried inserting my functions here with no success	    
	return;
}
 
which code did you alter? From what folder? What did you alter? Which files and what did you change/add?

Most important is what folder are you using.
 
Oh, sorry. I am using the code from **broken link removed**. For now, I am trying to make it so that when the USB is not connected it functions as a GLCD and takes readings from the ADC, and when the USB is connected I can download the information that I stored. So, I am trying to figure out how to switch between those two functions.
 
Shouldnt be too hard. You have to put the code in the main tho.
MAIN.C
Code:
void main(void)
{
    InitializeSystem();
    while(1)
    {
        USBTasks();         // USB Tasks
        ProcessIO();        // See user\user.c & .h
        //[b]TRY ADDING IT HERE[/b]
    }//end while
}//end main
 
Last edited:
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top