[PIC18]PC=0x0000. §MCLR§ is low.Processor is on reset.
[HD44780]Attemped to resd after writing a single nibble
#include <p18f4550.h>
#include <stdlib.h>
#include "system\typedefs.h" // Required
#include "system\usb\usb.h" // Required
#include "io_cfg.h" // Required
#include "system\usb\usb_compile_time_validation.h" // Optional
#include "user\user.h"
#include "C:\Users\Administrateur\Desktop\hid\HID\system\lcd\xlcd_driver.h"
#include <stdio.h>
#include <string.h>
#include <usart.h>
#define ON 1
#define OFF 0
/** V A R I A B L E S ********************************************************/
#pragma udata
/** P R I V A T E P R O T O T Y P E S ***************************************/
static void InitializeSystem(void);
void USBTasks(void);
/** V E C T O R R E M A P P I N G *******************************************/
extern void _startup (void); // See c018i.c in your C18 compiler dir
#pragma code _RESET_INTERRUPT_VECTOR = 0x000800
void _reset (void)
{
_asm goto _startup _endasm
}
#pragma code
/** D E C L A R A T I O N S **************************************************/
/******************************************************************************
* Function: void main(void)
*
* PreCondition: None
*
* Input: None
*
* Output: None
*
* Side Effects: None
*
* Overview: Main program entry point.
*
* Note: None
*****************************************************************************/
void main(void)
{
InitializeSystem();
init_lcd();
LCD_BACKLIGHT=ON;
lcd_gotoxy(3,0);
fprintf(_H_USER,"bienvenue");
lcd_gotoxy(5,1);
fprintf(_H_USER,"program");
lcd_gotoxy(0,2);
fprintf(_H_USER,"_initialisation_");
lcd_gotoxy(0,3);
fprintf(_H_USER,"___du systeme___");
// USBTasks();
while(1)
{
ProcessIO();
}//end while
}//end main
static void InitializeSystem(void)
{
ADCON1 |= 0x0F; // Default all pins to digital
mInitializeUSBDriver(); // See usbdrv.h
UserInit(); // See user.c & .h
USBTasks();
}//end InitializeSystem
void USBTasks(void)
{
/*
* Servicing Hardware
*/
USBCheckBusStatus(); // Must use polling method
if(UCFGbits.UTEYE!=1)
USBDriverService(); // Interrupt or polling method
}// end USBTasks
/** EOF main.c ***************************************************************/
#include <p18cxxx.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <usart.h>
#include "C:\Users\Administrateur\Desktop\hid\HID\system\typedefs.h"
#include "C:\Users\Administrateur\Desktop\hid\HID\system\usb\usb.h"
#include "C:\Users\Administrateur\Desktop\hid\HID\io_cfg.h" // I/O pin mapping
#include "C:\Users\Administrateur\Desktop\hid\HID\user\user.h"
#include "C:\Users\Administrateur\Desktop\hid\HID\system\lcd\picstar_def.h" //pour affichage
#include "C:\Users\Administrateur\Desktop\hid\HID\system\lcd\picstar_delays.h" //pour l'affichage
//#include "C:\Users\Administrateur\Desktop\hid\HID\system\lcd\xlcd_driver.h" // includes xlcd.h
#define ON 1
#define OFF 0
#define DIM 16
/** V A R I A B L E S ********************************************************/
#pragma udata
char Buffer[64];
char var[64] ;
/** D E C L A R A T I O N S **************************************************/
#pragma code
void UserInit(void)
{
LATB=0;
TRISBbits.TRISB0=0;
TRISBbits.TRISB1=0;
TRISBbits.TRISB2=0;
TRISBbits.TRISB3=0;
TRISBbits.TRISB4=0;
TRISBbits.TRISB5=0;
TRISBbits.TRISB6=0;
TRISBbits.TRISB7=0;
}//end UserInit
void ProcessIO(void)
{
int i;
int nb;
int lnBuffer ;
char t1[DIM +1];
char t2[DIM +1];
char t3[DIM +1];
char t4[DIM +1];
u8 counter=0 ;
u8 LCD_buffer[16];
USBTasks();
while(1)
{ i=0;
USBTasks();
if (HIDRxReport(Buffer,PacketSize ) > 0) // USB receive buffer has data
{
USBTasks();
PORTB=0x02;
delay_ms(200);
PORTB=0;
lcd_delete();
strcpy(var,Buffer);
nb=strlen(Buffer);
for (i=0;i< DIM;i++)
{
t1[i]=Buffer[i] ;
t2[i]=Buffer[DIM +i] ;
t3[i]=Buffer[2*DIM +i] ;
t4[i]=Buffer[3*DIM +i];
}
t1[DIM ]= '\0';
t2[DIM ]= '\0';
t3[DIM ]= '\0';
t4[DIM ]= '\0';
switch (var[2])
{
case 'm':
PORTB=0x00;
break;
case 'M':
PORTB=0x80;
break;
case 'c':
PORTB=0x40;
break;
case 'b':
PORTB=0x20;
break;
}// fin switch
lcd_gotoxy(0,0);
fprintf(_H_USER,"%s",t1);
lcd_gotoxy(0,1);
fprintf(_H_USER,"%s",t2);
lcd_gotoxy(0,2);
fprintf(_H_USER,"%s",t3);
lcd_gotoxy(0,3);
fprintf(_H_USER,"%s",t4);
delay_ms(20);
}// end if
}//end while
}//end ProcessIO
/** EOF user.c *********************************************************/
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?