Jump to content
Sign in to follow this  
Flyer

Novo And Lcd Routines

Recommended Posts

Has anyone run RTOS using the LCD routines? The demo routines run perfectly in both the IDE and in circuit, but as soon as I add in calls to the LCD everthing seems to stop.

 

Thanks

 

Peter

Share this post


Link to post
Share on other sites

Flyer,

Has anyone run RTOS using the LCD routines? The demo routines run perfectly in both the IDE and in circuit, but as soon as I add in calls to the LCD everthing seems to stop.
If the LCD routines block (waiting for a response from the LCD, maybe waiting forever if there is a problem with the LCD), then it will cause the Novo RTOS to stop because its a co-operative multi-tasking system.

 

The standard LCD routines don't call any Novo RTOS yielding functions while waiting. If the wait is only short, then it probably should be no problem, if the wait is long then RTOS will be stalled.

 

Regards

Dave

Share this post


Link to post
Share on other sites

More info

if the call to LCD_setup is after any call to SysCreateTask then a linker error

Internal Error: Var not found id:0x10000E01:0x008:0x00000250 in Function 'LCD_Read'

happens. The linker succeeds if the call is before SysCreateTask but then the program doesn't operate

Share this post


Link to post
Share on other sites

Flyer,

More info

if the call to LCD_setup is after any call to SysCreateTask then a linker error

Internal Error: Var not found id:0x10000E01:0x008:0x00000250 in Function 'LCD_Read'

happens. The linker succeeds if the call is before SysCreateTask but then the program doesn't operate

If you post an attachment that contains a simple sample project that demonstrates this issue it would help.

 

Novo RTOS has been used with the standard LCD routines quick successfully.

 

Regards

Dave

Share this post


Link to post
Share on other sites
Flyer,
More info

if the call to LCD_setup is after any call to SysCreateTask then a linker error

Internal Error: Var not found id:0x10000E01:0x008:0x00000250 in Function 'LCD_Read'

happens. The linker succeeds if the call is before SysCreateTask but then the program doesn't operate

If you post an attachment that contains a simple sample project that demonstrates this issue it would help.

 

Novo RTOS has been used with the standard LCD routines quick successfully.

 

Regards

Dave

Share this post


Link to post
Share on other sites

As requested, using 16F88 with LCD connected to portB only 4 bit

bit 0 - RS

bit 2 - R/W

bit 3 - E

bits 4-7 data

Works as below with LCD calls commented out, errors as above if enabled

Best regards

 

Peter

 

[///////////////////////////////////////////////

// Independant LED flash

///////////////////////////////////////////////

// Uses Novo RTOS

//

// This code flashes two LEDs at independant rates

// using 2 task to do this.

//

// Target Device: PIC16F88

//

// Author: David Hobday

//

// Version History:

// V1.0 - 17/09/2006

// Initial release.

 

#include <system.h>

#define LCD_ARGS 2, /* Interface type: mode 0 = 8bit, 1 = 4bit(low nibble), 2 = 4bit(upper nibble) */ \

1, /* Use busy signal: 1 = use busy, 0 = use time delays */\

PORTB, TRISB, /* Data port and data port tris register */ \

PORTB, TRISB, /* Control port and control port tris register */ \

0, /* Bit number of control port is connected to RS */ \

2, /* Bit number of control port is connected to RW */ \

3 /* Bit number of control port is connected to Enable */

 

#include <lcd_driver.h> // include the LCD template code

#include <novocfg_pic16t3e5ts1.h>

#include <novo.h>

 

#pragma DATA _CONFIG, _CP_OFF & _CCP1_RB0 & _DEBUG_OFF & _WRT_PROTECT_OFF & _CPD_OFF & _LVP_OFF & _BODEN_OFF & _MCLR_ON & _PWRTE_OFF & _WDT_OFF & _HS_OSC

#pragma CLOCK_FREQ 20000000

#define hTask0 0

#define hTask1 1

 

#define DELAY delay_s( 2 )

#define DELAY_SHORT delay_ms( 100 )

void interrupt( void )

{

// update system time every 1ms (actually is 204.8us x 5 = 1.024ms)

static BYTE intDivider;

if( ++intDivider == 5 )

{

intDivider = 0;

SysTimerUpdate();

}

 

intcon.TMR0IF = 0; //clear TMR0 overflow flag

}

 

void InitTimer()

{

// configure Timer0

option_reg.T0CS = 0; // use internal clock

option_reg.PSA = 0; // use prescaler form timer 0

 

 

// so we get an interrupt around every 204.8us with 20MHz Clock

// set prescaller to divide by 4

option_reg.PS0 = 1;

option_reg.PS1 = 0;

option_reg.PS2 = 0;

 

// enable interrupts

intcon.TMR0IE = 1; //enable TMR0 overflow bit

intcon.GIE = 1;

}

 

void Task0()

{

while( 1 )

{

porta.2 = 0;

Sys_Sleep( 100 );

porta.2 = 1;

Sys_Sleep( 100 );

}

}

 

void Task1()

{

while( 1 )

{

porta.1 = 0;

// 500ms delay

Sys_Sleep( 250 ); // can only sleep for a maximum of 255 with 8 bit timers

Sys_Sleep( 250 );

porta.1 = 1;

// 500ms delay

Sys_Sleep( 250 );

Sys_Sleep( 250 );

}

}

 

void main()

{

ansel = 1;

trisa = 0x01;

trisb = 0x00;

// lcd_setup();

InitTimer();

 

SysInit();

SysCreateTask( hTask0, 2, Task0 );

SysCreateTask( hTask1, 2, Task1 );

 

 

SysStartTask( hTask0 );

SysStartTask( hTask1 );

 

// lprintf("test");

while( 1 )

{

Sys_Yield();

}

}

Share this post


Link to post
Share on other sites

Join the conversation

You are posting as a guest. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

×
×
  • Create New...