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 support@ccsinfo.com

Having problems with PIC18F4620 I/Os

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



Joined: 16 Sep 2009
Posts: 21

View user's profile Send private message

Having problems with PIC18F4620 I/Os
PostPosted: Thu Mar 10, 2011 2:27 pm     Reply with quote

Hello,

I'm trying this code to display a message.
I can use the same i/o's with 16F877a (the LCD shows the message) but can't use them with 18f4620 to drive a 4x20 lcd with flex lcd driver

I thought the ECCP pins or the Interrupt activated portb pins were the problem but it seems like they are not.

The code is :
Code:
#include <18f4620.h>

#Fuses HS,NOWDT,NOPROTECT,NOBROWNOUT,NOLVP,NOPUT,NOWRT,NODEBUG,NOCPD
#device ADC=16
#use delay(clock=20000000)
#use rs232(baud=19200, xmit=pin_C6, rcv=pin_C7, parity=N, stop=1)

#byte P1B = 0xFBD
#byte PORTD = 0xF83
#byte TRISD = 0xF95
#byte PORTB = 0xF81
#byte TRISB = 0xF93

#define cs PIN_C2

#define clk PIN_C3

#define sdo PIN_C5

#include <Flex_LCD420_2Proto.c>
#include <stdlib.h>
#include <math.h>
#include <Button.c>



void lcd_welcome()

   lcd_gotoxy(1,1);
   printf(lcd_putc,"   *****v0.7*****   "); 
   Delay_ms(2000);
   printf(lcd_putc,"\f");
}



void main()

{
   port_b_pullups(TRUE);
   setup_adc(ADC_CLOCK_DIV_64); //6.4 us de bir data oku =*250 = 1.6 ms
   //setup_adc_ports(AN0_TO_AN1);
   P1B = 0;
   PORTD = 0;
   PORTB = 0;
   TRISD = 0;
   TRISB = 0;
   
   setup_psp(PSP_DISABLED);
   setup_spi(SPI_MASTER|SPI_H_TO_L|SPI_CLK_DIV_64);
   setup_timer_0(RTCC_INTERNAL|RTCC_DIV_1);
   setup_timer_1(T1_DISABLED);
   setup_timer_2(T2_DISABLED,0,1);
   setup_comparator(NC_NC_NC_NC);
   setup_vref(FALSE);
   setup_ccp1(CCP_OFF);
   disable_interrupts(global);
   
   
   lcd_init();
   Store_Custom_Char();
   lcd_welcome();
   while (1){
      lcd_welcome();
      output_high(pin_A2);
      delay_ms(500);
      output_low(pin_A2);
      delay_ms(500);
   }
}   



The LCD pins are :

Code:

// Flex_LCD420.c

// These pins are for my Microchip PicDem2-Plus board,
// which I used to test this driver.
// An external 20x4 LCD is connected to these pins.
// Change these pins to match your own board's connections.

#define LCD_DB4   PIN_D4
#define LCD_DB5   PIN_D5
#define LCD_DB6   PIN_D6
#define LCD_DB7   PIN_D7

#define LCD_RS    PIN_B2     
#define LCD_RW    PIN_B4
#define LCD_E     PIN_B5



Thanks for your help...
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Thu Mar 10, 2011 3:40 pm     Reply with quote

What is your CCS compiler version ?
salgulsen



Joined: 16 Sep 2009
Posts: 21

View user's profile Send private message

PostPosted: Thu Mar 10, 2011 5:02 pm     Reply with quote

my compiler version is 4.104
salgulsen



Joined: 16 Sep 2009
Posts: 21

View user's profile Send private message

PostPosted: Fri Mar 11, 2011 2:39 pm     Reply with quote

I'm still out of clue what can cause the problem... Crying or Very sad
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Fri Mar 11, 2011 3:09 pm     Reply with quote

Delete 90% of your code and try a very simple test program:
Code:

#include <18F4620.h>
#fuses INTRC_IO, NOWDT, BROWNOUT, PUT, NOLVP
#use delay(clock=4M)

#include <Flex_LCD420.c>   

//=========================================
void main()
{     
lcd_init();

lcd_putc("Hello World");

while(1);
}
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