Announcement

Collapse
No announcement yet.

Comunication with PIC18F4585

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • alexpuchalt
    replied
    Hi Paul, it return to me the same error I update the code with the functions that you give to me, I attached it:

    #define RESET PIN_A0

    #include "fuses.h"
    #include "visi_genie.h"

    extern unsigned long millis(void);
    extern uint16_t genieGetByteCount(void);
    extern uint8_t genieGetByte(void);
    extern uint8_t geniePeekByte(void);
    extern void geniePutByte(uint8_t);

    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);

    genieBegin();

    output_low(RESET) == 0;
    delay_ms(200);
    output_high(RESET) == 1;
    delay_ms(10000);

    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:

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

    Leave a comment:


  • pauleilio
    replied
    Hi

    Thanks for the feedback

    The library is designed to be generic so it would require the user to setup some functions.

    These are the functions that you will need to set up.

    extern unsigned long millis(void);
    extern uint16_t genieGetByteCount(void);
    extern uint8_t genieGetByte(void);
    extern uint8_t geniePeekByte(void);
    extern void geniePutByte(uint8_t);

    Best regards

    Paul

    Leave a comment:


  • alexpuchalt
    replied
    Hi Paul, here you have the error that give to me, also with genieWriteObject():

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

    Apart of that, do I need another function to write to an object in the display?

    Thanks,

    Àlex.

    Leave a comment:


  • pauleilio
    replied
    Hi,

    Not really sure why there is a error with genieBegin() could you please tell me the error that was reported.

    Best regards

    Paul

    Leave a comment:


  • alexpuchalt
    started a topic Comunication with PIC18F4585

    Comunication with PIC18F4585

    Hi, I was programing with CCS the program to compile to the PIC. But it give me an error with genieBegin(); How can I solve it?

    Here is the program:

    #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);


    genieBegin();

    output_low(RESET) == 0;
    delay_ms(200);
    output_high(RESET) == 1;
    delay_ms(10000);

    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;

    }
    }
    }
Working...
X