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

Program PIC to communicate with 4D System display

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



Joined: 24 Mar 2020
Posts: 3
Location: Barcelona

View user's profile Send private message Visit poster's website

Program PIC to communicate with 4D System display
PostPosted: Tue Mar 24, 2020 2:43 pm     Reply with quote

Hi, I have to communicate with PIC18F4585 to the 4Dsystem's display uLCD 70D through serial. I download the libraries and all things I need but it gives me an error when I compile it.

Have someone experience with this kind of display?

I attached to you the program and the error:
Code:
#define RESET  PIN_A0
#include "fuses.h"
#include "visi_genie.h"

unsigned int32 milis = 0, milisRPM = 0;
int gaugeAddVal = 100;
int gaugeVal = 0;

#int_timer0
void isr_timer0(void) 
{
   set_timer0(63035);
     
   milis++;
}

void main(void)
{
   setup_timer_0(RTCC_INTERNAL);
   enable_interrupts(INT_TIMER0);

   setup_adc_ports(NO_ANALOGS|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|RTCC_8_bit);
   setup_timer_1(T1_DISABLED);
   setup_timer_2(T2_DISABLED,0,1);
   setup_timer_3(T3_DISABLED|T3_DIV_BY_1);
   setup_vref(FALSE);
   enable_interrupts(GLOBAL);
   
   output_low(RESET) == 0;
   delay_ms(200);
   output_high(RESET) == 1;
   delay_ms(5000);
   
   genieBegin();
   
   genieWriteContrast(10);
   
   while(1)
   {
      if (milisRPM + 200 < milis)
      {
         milisRPM = milis;
         
         genieWriteObject(GENIE_OBJ_GAUGE, 0, gaugeVal);
         genieWriteObject(GENIE_OBJ_LED_DIGITS, 3, gaugeVal);
         
         gaugeVal = gaugeVal + gaugeAddVal;
         if (gaugeVal == 8000) gaugeAddVal = -100;
         if (gaugeVal == 0) gaugeAddVal = 100;
         
      }
   }
}

And the error:
Quote:

*** Error 112 "display.c" Line 35(1,1): Function used but not defined: ... genieBegin 821 SCR=1813
temtronic



Joined: 01 Jul 2010
Posts: 9226
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Tue Mar 24, 2020 2:53 pm     Reply with quote

this function....

genieBegin();

is being called but not found.

It might supposed to be in the file ..#include "visi_genie.h"
however I don't know what's in there.

I suggest you contact the original programmer or website where you got the code.

also
the first line in your code needs to be the processor header file.
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Tue Mar 24, 2020 6:41 pm     Reply with quote

Where did you get the visi_genie.h file ? It's probably compatible with
Arduino and not CCS. Post a link to the website where you got visi_genie.h.
Ttelmah



Joined: 11 Mar 2010
Posts: 19515

View user's profile Send private message

PostPosted: Wed Mar 25, 2020 2:30 am     Reply with quote

Also as a minor comment, this line:

setup_spi(SPI_SS_DISABLED);

is wrong. Correct line is:

setup_spi(FALSE);

This is a common error where people use the wizard, and get the SPI
setup wrong....

I'd suggest he is probably using the Visi-Genie platform creator tool,
this is meant to generate semi compatible libraries for this display.
First thing to do is simple, switch the compiler to ANSI mode.
The tool will be assuming ANSI data sizes and declarations.

As a separate comment, no data on what clock rate he is running, but
'issues' with the settings being used. Timer0, is being set to run
in 8bit mode, then advanced to 63035. If is is in 8bit mode, this
will set the low byte to C5, so it'll attempt to interrupt every 58
instruction clocks. The code will probably never get out of this
interrupt handler....

Suspect he has missed that the timer is being configured twice.
The first setup would give every 2500 instruction clocks, still awful
but at least doable....

There is a note in some of the pages where people are using the
Visi-Genie tool that 'GenieBegin no longer exists'. It is meant to
be a call to tell the library code, what serial port to use, and the
baud rate. The library code will need to have been re-written to
simply use the CCS serial functions, and GenieBegin removed.
alexpuchalt



Joined: 24 Mar 2020
Posts: 3
Location: Barcelona

View user's profile Send private message Visit poster's website

PostPosted: Wed Mar 25, 2020 12:54 pm     Reply with quote

PCM programmer wrote:
Where did you get the visi_genie.h file ? It's probably compatible with
Arduino and not CCS. Post a link to the website where you got visi_genie.h.


https://github.com/4dsystems/ViSi-Genie-C-Library

I get the library from that link. I post in the official forum of 4D Systems and they said to me that it's compatible.
alexpuchalt



Joined: 24 Mar 2020
Posts: 3
Location: Barcelona

View user's profile Send private message Visit poster's website

PostPosted: Wed Mar 25, 2020 2:31 pm     Reply with quote

Ttelmah wrote:
Also as a minor comment, this line:

setup_spi(SPI_SS_DISABLED);

is wrong. Correct line is:

setup_spi(FALSE);

This is a common error where people use the wizard, and get the SPI
setup wrong....

I'd suggest he is probably using the Visi-Genie platform creator tool,
this is meant to generate semi compatible libraries for this display.
First thing to do is simple, switch the compiler to ANSI mode.
The tool will be assuming ANSI data sizes and declarations.

As a separate comment, no data on what clock rate he is running, but
'issues' with the settings being used. Timer0, is being set to run
in 8bit mode, then advanced to 63035. If is is in 8bit mode, this
will set the low byte to C5, so it'll attempt to interrupt every 58
instruction clocks. The code will probably never get out of this
interrupt handler....

Suspect he has missed that the timer is being configured twice.
The first setup would give every 2500 instruction clocks, still awful
but at least doable....

There is a note in some of the pages where people are using the
Visi-Genie tool that 'GenieBegin no longer exists'. It is meant to
be a call to tell the library code, what serial port to use, and the
baud rate. The library code will need to have been re-written to
simply use the CCS serial functions, and GenieBegin removed.


Thanks for your comment of the setup_spi.

I change the compiler mode to ANSI and it returns to me the same error.

Can you explain me what you are saying of the clock? I'm quite beginner programming and it slip out of my hands.

And the last thing, when you say to re-write to use serial functions from CCS, how can I do it?.

The program also give me the same error with the other GENIE functions.

Thank you so much for your feedback.
temtronic



Joined: 01 Jul 2010
Posts: 9226
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Wed Mar 25, 2020 2:48 pm     Reply with quote

yeesh.. bad enough we've got 'wizards' that ain't too smart, NOW there's a 'geni' that is supposed to know all ?????

sigh....
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