CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

cannot display characters using lcd.h and usb_cdc.h (solved)

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
pfsdanny



Joined: 20 Nov 2010
Posts: 11
Location: Hong Kong

View user's profile Send private message

cannot display characters using lcd.h and usb_cdc.h (solved)
PostPosted: Mon Jan 17, 2011 12:37 am     Reply with quote

Hi,

Here is my code
tester01.h :-
Code:

#FUSES NOBROWNOUT               //No brownout reset
#FUSES BORV19               
#FUSES NOPUT                    //No Power Up Timer
#FUSES NOCPD                    //No EE protection
#FUSES STVREN                   //Stack full/underflow will cause reset
#FUSES NOXINST                  //Extended set extension and Indexed Addressing mode disabled (Legacy mode)
#FUSES NOWRT                    //Program memory not write protected
#FUSES NOWRTD                   //Data EEPROM not write protected
#FUSES NOWRTC                   //configuration not registers write protected
#FUSES NOIESO                   //Internal External Switch Over mode disabled
#FUSES NOEBTR                   //Memory not protected from table reads
#FUSES NOEBTRB                  //Boot block not protected from table reads
#FUSES MCLR                     //Master Clear pin enabled
#FUSES NOPROTECT                //Code not protected from reading
#FUSES NOCPB                    //No Boot Block code protection
#FUSES NOWRTB                   //Boot block not write protected
#FUSES NOLVP                    //No low voltage prgming, B3(PIC16) or B5(PIC18) used for I/O
#FUSES HFOFST               
#FUSES USBDIV2               
#FUSES PLLEN                 
#FUSES BBSIZ1K                  //1K words Boot Block size
#FUSES CPUDIV1                  //No System Clock Postscaler
#FUSES PCLKEN               
#FUSES NODEBUG                    //Debug mode for use with ICD

#use delay(clock=12000000)
#use rs232(baud=9600,parity=N,xmit=PIN_B7,rcv=PIN_B5,bits=8)


tester01.c :-
Code:

#include <tester01.h>
#define LCD_ENABLE_PIN PIN_C6
#define LCD_RS_PIN PIN_C4
#define LCD_RW_PIN PIN_C5
#define LCD_DATA4 PIN_C0
#define LCD_DATA5 PIN_C1
#define LCD_DATA6 PIN_C2
#define LCD_DATA7 PIN_C3
#include <lcd.c>
#include <usb_cdc.h>
#use fast_io(b)
#use fast_io(c)


void main()
{
   output_high(UARTREQUEST);
   set_tris_b(0b00110000);
   set_tris_c(0b10000000);
   lcd_init();
   usb_init_cs();
   setup_adc_ports(sAN9|VSS_VDD);
   setup_adc(ADC_CLOCK_DIV_2|ADC_TAD_MUL_0);
   setup_spi(SPI_SS_DISABLED);
   setup_wdt(WDT_OFF);
   setup_timer_0(RTCC_INTERNAL);
   setup_timer_1(T1_DISABLED);
   setup_timer_2(T2_DISABLED,0,1);
   setup_timer_3(T3_DISABLED|T3_DIV_BY_1);
   setup_ccp1(CCP_OFF);
   setup_comparator(NC_NC_NC_NC);// This device COMP currently not supported by the PICWizard

   //TODO: User Code
   lcd_putc("\fHello");
   while (true) {
   
   }
}

The lcd display just show blocks not characters. When I remark the #include <usb_cdc.h> and usb_init_cs() the display is ok. Is there somthing wrong with my code?
I have compiled another program to test the usb function and it works ok.

Danny
pfsdanny



Joined: 20 Nov 2010
Posts: 11
Location: Hong Kong

View user's profile Send private message

memory too large
PostPosted: Mon Jan 17, 2011 4:02 am     Reply with quote

I just modify the statement

From
Code:

struct commProp {
   unsigned int8 count;
   unsigned int8 size;
   unsigned int8 buffer[20];
} uart, usb;

To
Code:

struct commProp {
   unsigned int8 count;
   unsigned int8 size;
   unsigned int8 buffer[17];
} uart, usb;

Although the CCS reported that I have available memory, but the LCD does not display anything when the buffer size is larger than 17. Does not know whether this is a compiler bug or not.
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group