Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

problem regarding pic18F4550

Status
Not open for further replies.

simon_12

Junior Member level 3
Joined
Sep 7, 2009
Messages
28
Helped
1
Reputation
2
Reaction score
1
Trophy points
1,283
Activity points
1,476
pic18f2550 mchpusb driver example

Hi all

I am using PICDEMFSUSB example in MCHPUSB - generic driver demo folder of MCHPFSUSB framework v2.5a. I am using pic18F4550 for non-microchip board not fo PICDEMFSUSB board.

I want to use pic18F4550 as a data acquisition card.

1) After the ADC has performed conversion and the data is in ADRESL:ADRESH , now HOW TO SEND that data
to the PC? Please explain in detail.

2) Where do i initialize these registers of18f4550 UCFG , UCON and UEPn ?

3) For my application as mentioned, WHat PING - PONG mode do i select?


Does any one of you have done the same as i wanted to do , if you have the PICDEM FS FILE completely edited
and you have also written the routines for ADC and sending its data to the pc in Process IO() then please send me.

Any help greatly appreciated.
 

pic18f spi not working

1) and 2) - depending which USB class are you using. It should be easy to find demo implementations of CDC (serial port) and HID from Microchip.
You probably don't have to bother with ADC details as there is library supplied with C18 compiler with functions like OpenADC, ConvertADC, ReadADC.
I've made similar project few years ago, installer is at https://tomeko.net/miniscope.php, it will copy C18 sources for PIC (well, probably less than 100 lines of custom code).
PIC code is modified CDC example, sampling is triggered by sw1 switch (you probably will want to redefine it). It uses 8 bit samples, sampling up to 25kSps.
 

pic 18f4550

Has anyone done the same application as mentioned above by using MCHPFSUSBv2.5? If so , please send.
 

pic18f4550 hid c18 adc

I am currently working on a project quite alike, but I am using v2.4. It's just CDC basic demo and I can monitor sensors and control LEDs with a VB application..
 

pic18f4550 spi not working

Hi grindylow , please send me when you complete. It can be helpful for me.
 

mchpusb driver problem

Hi grindylow , please send me when you complete. It can be helpful for me.
Well if you want to get started you just need to modify the examples. On my case, I modified the CDC basic demo. I specifically modified the UserInit() and ProcessIO() functions and also the Hardware Profile. I got some help when I am starting on the project through this site:
**broken link removed**
you might want to check out the post on my SPI problem:

and about the ADC I have a code here that I used for LM35(the one in the electronicfr site just didn't worked for me), just insert it in one of the case:
Code:
case 'C' :
		OpenADC(ADC_FOSC_8 & ADC_RIGHT_JUST & ADC_0_TAD,
                	ADC_CH0 & ADC_INT_OFF & ADC_VREFPLUS_VDD & 
					ADC_VREFMINUS_VSS, 0b1011);
        	SetChanADC(ADC_CH0);
        	Delay10TCYx( 50 );
        	ConvertADC(); // Start conversion
      		while( BusyADC() ); // Wait for ADC conversion
        	temp = ReadADC(); // Read result and put in temp
        	CloseADC(); // Disable A/D converter
			temp = temp*4.89;
			itoa(temp, USB_In_Buffer);      // Convert to a string
			USB_In_Buffer[4] = USB_In_Buffer[2];
			USB_In_Buffer[3] = '.';
			USB_In_Buffer[2] = USB_In_Buffer[1];
			USB_In_Buffer[1] = USB_In_Buffer[0];
			USB_In_Buffer[0] = 'T';
			USB_In_Buffer[5] = 0x00;	
			if(mUSBUSARTIsTxTrfReady())
			{
				putUSBUSART(USB_In_Buffer, 6);
			}
break;
 

pic18f4550 examples in visual basic

Hi grindy low

You wrote the following code
OpenADC(ADC_FOSC_8 & ADC_RIGHT_JUST & ADC_0_TAD,
ADC_CH0 & ADC_INT_OFF & ADC_VREFPLUS_VDD &
ADC_VREFMINUS_VSS, 0b1011);


1) Can you tell me what do i have to write , if i want to use all 13 channels of pic18f4550 as analog inputs?

2) Do you know how to communicate labview with USB DATA ACQUISITION CARD based on pic18f4550 ?

[/quote]
 

mchpfsusb framework v2.4

any registers you want to configure just write them inside the main() function but not inside the while(1) loop, remember you have already ISR so don't create a new ISR.
good luck
 

openadc readadc

1) Can you tell me what do i have to write , if i want to use all 13 channels of pic18f4550 as analog inputs?
I am not sure of this, but base on my interpretation of the C18 Manual it is based on the portconfig. In my example it's 0b1011. That means AN0-AN3 are analog inputs. So if you want to use all 13 channels(I don't know what you are going to do with that - 13 sensors?) it should be 0b0000, but there is a note, PBADEN must be on in your configuration bit. It's in the datasheet try to read the ADC part, there's a table there for the ADCON1 register bits 3-0.

2) Do you know how to communicate labview with USB DATA ACQUISITION CARD based on pic18f4550 ?
I have heard of it but never really looked at it. I use Visual Basic –there is an example from Microchip, I just edited it out.

any registers you want to configure just write them inside the main() function but not inside the while(1) loop, remember you have already ISR so don't create a new ISR.
That is right and I might revise that. I just don't know why the OpenADC statement includes a channel selection while it can be modified in SetChannel statement. If I set a channel 0 in the OpenADC statement, is it okay if I use channel 1 in the SetChannel statement? And would that not conflict?
 

demo pic 18f4550

use the registers ADCON0,ADCON1,ADCON2 instead of OpenADC and SetChan() if they are not working, i tried this method and worked fine.
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top