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

help needed with LCD module [solved]

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



Joined: 15 Mar 2011
Posts: 5

View user's profile Send private message

help needed with LCD module [solved]
PostPosted: Thu Mar 17, 2011 8:07 am     Reply with quote

Using a PIC16F917 and PCM v 4.119, trying to get a 3 segment Static LCD going. Wasn't happening with my code, so I tried the CCS ex_92LCD, which looked similar to what I was doing before...the below is a stripped down version of the code made to just flash '888' and '000'.

The code hang when it comes to lcd_symbol(). The assembly code continually looks for the WA bit in the LCDPS register to go high. This bit when high signifies that a write to the LCDDATAx registers is allowed. The problem is that this bit is always low in my program.

When I write directly to the LCDDATAx registers even when WA is low the WERR bit in the LCDCON register stays low. This bit I would think should go high if the LCDDATAx registers are written when WA is low...but doesn't. I've been searching the data sheets trying to figure out what controls the WA bit, but haven't had any luck. I was playing around with LCD interrupts...but blindly...not sure if I need to. Looking at the 16C924 data sheet (ex_92LCD was made for this chip) the LCD module looked similar to the F917, figured it'd be transferrable.



Code:

#include <16f917.h>
#fuses INTRC_IO,NOWDT,PUT
#use delay(clock=4000000)


// Digit segments    A        B        C        D        E        F        G        DP
//                   b7       b6       b5       b4       b3       b2       b1       b0
#define DIGIT3    COM0+27, COM0+28, COM0+29, COM0+30, COM0+8, COM0+9, COM0+10    //100s place
#define DIGIT2    COM0+3, COM0+24, COM0+2, COM0+40, COM0+39, COM0+5, COM0+26   // 10s place
#define DIGIT1    COM0+33, COM0+34, COM0+35, COM0+36, COM0+6, COM0+7, COM0+18   // 1s place      

//         character         0    1    2    3    4    5    6    7    8    9
byte const Digit_Map[10] = {0xFC,0x60,0xDA,0xF2,0x66,0xB6,0xBE,0xE0,0xFE,0xE6};

void main() {


   setup_lcd(LCD_STATIC|LCD_INTRC, 2, 0xfff4ff);
   
   while(TRUE)   {

       lcd_symbol(Digit_Map[0],DIGIT3); // fill 100s place
        lcd_symbol(Digit_Map[0],DIGIT2); // fill  10s place
        lcd_symbol(Digit_Map[0],DIGIT1); // fill   1s place

      delay_ms(500);

       lcd_symbol(Digit_Map[8],DIGIT3); // fill 100s place
        lcd_symbol(Digit_Map[8],DIGIT2); // fill  10s place
        lcd_symbol(Digit_Map[8],DIGIT1); // fill   1s place

      delay_ms(500);

   }
   
}


Last edited by tefbox on Thu Mar 17, 2011 10:18 am; edited 1 time in total
tefbox



Joined: 15 Mar 2011
Posts: 5

View user's profile Send private message

PostPosted: Thu Mar 17, 2011 10:18 am     Reply with quote

Started testing on the actual circuit versus using MPLAB SIM and other than my pin mapping being off, the code doesn't seem to have the same issue as it does in the sim. maybe the lcd module doesn't work in the sim...i have no idea...just happy it's working.
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