Jump to content

Doglao

EstablishedMember
  • Content Count

    15
  • Joined

  • Last visited

Community Reputation

0 Neutral

About Doglao

  • Rank
    Newbrie
  • Birthday 02/02/1971

Contact Methods

  • MSN
    douglasantosp@hotmail.com
  • Website URL
    http://
  • ICQ
    0

Profile Information

  • Gender
    Male
  • Location
    São Paulo Brazil
  • Interests
    Microcontrollers, embedded systems, c/c++ programming , Qt programming, hardware with pic, work abroad if possible.
  1. Here are some functions that will be added to lcd_driver.h file in the future and a sample program that switches between two sets of user defineable characters, one stored in PIC RAM the other in PIC ROM. These functions may change before they finally get added to lcd_driver.h, but they do work as they are: #include <system.h> #pragma CLOCK_FREQ 40000000 #define LCD_ARGS 1, /* Interface type: mode 0 = 8bit, 1 = 4bit(low nibble), 2 = 4bit(upper nibble) */ \ 1, /* Use busy signal: 1 = use busy, 0 = use time delays */\ PORTC, TRISC, /* Data port and data port tris register */ \ PORTB, TRISB, /* Control port and control port tris register */ \ 5, /* Bit number of control port is connected to RS */ \ 6, /* Bit number of control port is connected to RW */ \ 7 /* Bit number of control port is connected to Enable */ #include <lcd_driver.h> void lcd_setcgram( const unsigned char *lcd_pattern, unsigned char firstChar, unsigned char numbChars ) { unsigned char address; firstChar <<= 3; // this value now becomes the offset to the last piece of data numbChars <<= 3; // this value now becomes the number of pieces of data left to transfer address= 0x40; address += firstChar; address += numbChars; while( numbChars ) { address--; numbChars--; lcd_function( address ); lcd_datamode(); lcd_write( lcd_pattern[numbChars] ); } } void lcd_setcgram( rom unsigned char *lcd_pattern, unsigned char firstChar, unsigned char numbChars ) { unsigned char address; firstChar <<= 3; // this value now becomes the offset to the last piece of data numbChars <<= 3; // this value now becomes the number of pieces of data left to transfer address= 0x40; address += firstChar; address += numbChars; while( numbChars ) { address--; numbChars--; lcd_function( address ); lcd_datamode(); lcd_write( lcd_pattern[numbChars] ); } } const unsigned char lcd_pattern[64]={0x00,0x00,0x1F,0x1F,0x0E,0x0E,0x04,0x00, // 0: ARROW DOWN 0x00,0x00,0x04,0x0E,0x0E,0x1F,0x1F,0x00, // 1: ARROW UP 0x00,0x0E,0x11,0x11,0x11,0x0E,0x00,0x00, // 2: EMPTY BALL 0x00,0x0E,0x1F,0x1F,0x1F,0x0E,0x00,0x00, // 3: FILLED BALL 0x1F,0x1F,0x00,0x00,0x11,0x11,0x1B,0x1F, // 4: REVERSED ARROW DOWN 0x1F,0x1F,0x1B,0x11,0x11,0x00,0x00,0x1F, // 5: REVERSED ARROW UP 0x10,0x18,0x1C,0x1E,0x1C,0x18,0x10,0x00, // 6: ARROW RIGHT 0x01,0x03,0x07,0x0F,0x07,0x03,0x01,0x00}; // 7: ARROW LEFT rom unsigned char* rlcd_pattern={ 0x00,0x00,0x1F,0x1F,0x0E,0x0E,0x04,0x1F, // 0: ARROW DOWN 0x00,0x00,0x04,0x0E,0x0E,0x1F,0x1F,0x1F, // 1: ARROW UP 0x00,0x0E,0x11,0x11,0x11,0x0E,0x00,0x1F, // 2: EMPTY BALL 0x00,0x0E,0x1F,0x1F,0x1F,0x0E,0x00,0x1F, // 3: FILLED BALL 0x1F,0x1F,0x00,0x00,0x11,0x11,0x1B,0x00, // 4: REVERSED ARROW DOWN 0x1F,0x1F,0x1B,0x11,0x11,0x00,0x00,0x00, // 5: REVERSED ARROW UP 0x10,0x18,0x1C,0x1E,0x1C,0x18,0x10,0x1F, // 6: ARROW RIGHT 0x01,0x03,0x07,0x0F,0x07,0x03,0x01,0x1F}; // 7: ARROW LEFT void main() { lcd_setup(); lcd_clear(); lcd_gotoxy( 0, 0 ); { lprintf( "ABCDEF" ); // display user definable characters lcd_write( 0x00 ); lcd_write( 0x01 ); lcd_write( 0x02 ); lcd_write( 0x03 ); lcd_write( 0x04 ); lcd_write( 0x05 ); lcd_write( 0x06 ); lcd_write( 0x07 ); } while( 1 ) { // switch between user definable character data from RAM and ROM delay_s( 1 ); lcd_setcgram( lcd_pattern, 0, 8 ); delay_s( 1 ); lcd_setcgram( rlcd_pattern, 0, 8 ); } } Regards Dave Sorry for I not reply before, I'm in a travel!! Thanks for this reply, i'm going to prove and I post the results here, very thanks Masy and Dave
  2. Hi! I make a attempt to create a backslash in a CGRAM display but this not works, my code make use of display driver commands, how I can do this work? thanks lcd_funcmode(); lcd_write(0x40); // set 40 lcd_datamode(); lcd_write( 0x00 ); // 00000 lcd_write( 0X00 ); // 00000 lcd_write( 0X10 ); // 10000 lcd_write( 0X08 ); // 01000 lcd_write( 0X04 ); // 00100 lcd_write( 0X02 ); // 00010 lcd_write( 0X01 ); // 00001 lcd_write( 0X00 ); // 00000 lcd_datamode(); lcd_gotoxy(1,1); lcd_write (0x00);
  3. Hi! I changed the target device to pic16F877A with few changes in the A/D configurations to simulate with SourceBoost IDE using variable PSU to the port A0, this works fine now and I can see how this code works, is very pretty how this tasks running, and how is used the Novo API to handle events, very good example, I understand more about Novo RTOS with this example. thanks Douglas
  4. Hi! Flyer In accordance with the configuration file name novocfg_pic16t5e5ts1.h you re-build it the Novo libraries for 5 tasks, 5 events and the timer size with a one byte, and no priority because the letter P was ommited at the end of file name. I don't see this amount of events in the code and have only 3 tasks, why do you re-compile with this extras tasks and events? is this tasks hidden for us, or you just make this to probe how to re-build libraries? is this file name equal to the configurations within the file? is not missing the function SysSignalSemaphore(hSemaphore) at the start of program? thanks
  5. Hi! Flyer I'm very interested to probe your code but I can't simulate it in boostc++, I lead the Signal Generator plugin with the checkbox for DC signal in the porta.0 and nothing change, then, I comment the line Sys_WaitSemaphore(hSemaphore, EVENT_NO_TIMEOUT); to avoid that the task1 goes to break, but nothing work, only changes the hartbeat at task0 and RA1 in the task2. can you simulate with the boostc++ for full debuging your code? thanks
  6. You need to add the appropriate novo library (.lib file) to the project, the right one needs to match the novocfg file that you are including. Regards Dave Thanks Dave! this work fine now!! Douglas
  7. this compile fine, but to linking show this errors. what is need to do this to link? Linking... "D:\Program Files\SourceBoost\boostlink.pic.exe" /ld "D:\Program Files\SourceBoost\lib" libc.pic16.lib novoexemplo1.obj /t PIC16F88 /d D:\proyectos\microcontroladores\boostc++\novo\teste1 /p novoexemplo1 -swcs BoostLink Optimizing Linker Version 6.82 http://www.sourceboost.com Copyright© 2004-2007 Pavel Baranov Copyright© 2004-2007 David Hobday Error: Unresolved external function:'SysiSignalSemaphore(unsigned char)' Error: Unresolved external function:'SysiSignalSemaphore(unsigned char)' Error: Unresolved external function:'SysiSleep(unsigned char)' Error: Unresolved external function:'SysiSleep(unsigned char)' Error: Unresolved external function:'SysiWaitSemaphore(unsigned char,unsigned char)' Error: Unresolved external function:'SysiWaitSemaphore(unsigned char,unsigned char)' Error: Unresolved external function:'SysiSleep(unsigned char)' Error: Unresolved external function:'SysiWaitSemaphore(unsigned char,unsigned char)' Error: Unresolved external function:'SysiWaitSemaphore(unsigned char,unsigned char)' Error: Unresolved external function:'SysiSleep(unsigned char)' Error: Unresolved external function:'SysiSleep(unsigned char)' Error: Unresolved external function:'SysiSleep(unsigned char)' Error: Unresolved external function:'SysiSleep(unsigned char)' Error: Unresolved external function:'SysiSleep(unsigned char)' Error: Unresolved external function:'SysiSleep(unsigned char)' Error: Unresolved external function:'SysiSleep(unsigned char)' Error: Unresolved external function:'SysiSleep(unsigned char)' Error: Unresolved external function:'SysiSleep(unsigned char)' Error: Unresolved external function:'SysiCreateTask(unsigned char,unsigned char,unsigned char)' Error: Unresolved external function:'SysiCreateTask(unsigned char,unsigned char,unsigned char)' Error: Unresolved external function:'SysiCreateTask(unsigned char,unsigned char,unsigned char)' Error: Unresolved external function:'SysiCreateTask(unsigned char,unsigned char,unsigned char)' Error: Unresolved external function:'SysiCreateTask(unsigned char,unsigned char,unsigned char)' Error: Unresolved external function:'SysiCreateTask(unsigned char,unsigned char,unsigned char)' Error: Unresolved external function:'SysiCreateTask(unsigned char,unsigned char,unsigned char)' Error: Unresolved external function:'SysiCreateTask(unsigned char,unsigned char,unsigned char)' Error: Unresolved external function:'SysiCreateTask(unsigned char,unsigned char,unsigned char)' Error: Unresolved external function:'SysStartTask(unsigned char)' Error: Unresolved external function:'SysStartTask(unsigned char)' Error: Unresolved external function:'SysStartTask(unsigned char)' Error: Unresolved external function:'SysiCreateTask(unsigned char,unsigned char,unsigned char)' Error: Unresolved external function:'SysiCreateTask(unsigned char,unsigned char,unsigned char)' Error: Unresolved external function:'SysiCreateTask(unsigned char,unsigned char,unsigned char)' Error: Unresolved external function:'SysiCreateTask(unsigned char,unsigned char,unsigned char)' Error: Unresolved external function:'SysiCreateTask(unsigned char,unsigned char,unsigned char)' Error: Unresolved external function:'SysiCreateTask(unsigned char,unsigned char,unsigned char)' Error: Unresolved external function:'SysiCreateTask(unsigned char,unsigned char,unsigned char)' Error: Unresolved external function:'SysiCreateTask(unsigned char,unsigned char,unsigned char)' Error: Unresolved external function:'SysiCreateTask(unsigned char,unsigned char,unsigned char)' Error: Unresolved external function:'SysStartTask(unsigned char)' Error: Unresolved external function:'SysStartTask(unsigned char)' Error: Unresolved external function:'SysStartTask(unsigned char)' Error: Unresolved external function:'SysTimerUpdate(void)' Error: Unresolved external symbol, function:SysTimerUpdate Error: Unresolved external function:'SysiSignalSemaphore(unsigned char)' Error: Unresolved external symbol, function:SysiSignalSemaphore Error: Unresolved external function:'SysiSleep(unsigned char)' Error: Unresolved external symbol, function:SysiSleep Error: Unresolved external function:'Sys_Yield(void)' Error: Unresolved external symbol, function:Sys_Yield Error: Unresolved external function:'SysiWaitSemaphore(unsigned char,unsigned char)' Error: Unresolved external symbol, function:SysiWaitSemaphore Error: Unresolved external function:'Sys_Yield(void)' Error: Unresolved external symbol, function:Sys_Yield Error: Unresolved external function:'SysiSleep(unsigned char)' Error: Unresolved external symbol, function:SysiSleep Error: Unresolved external function:'Sys_Yield(void)' Error: Unresolved external symbol, function:Sys_Yield Error: Unresolved external function:'SysiSleep(unsigned char)' Error: Unresolved external symbol, function:SysiSleep Error: Unresolved external function:'Sys_Yield(void)' Error: Unresolved external symbol, function:Sys_Yield Error: Unresolved external function:'SysiSleep(unsigned char)' Error: Unresolved external symbol, function:SysiSleep Error: Unresolved external function:'Sys_Yield(void)' Error: Unresolved external symbol, function:Sys_Yield Error: Unresolved external function:'SysiSleep(unsigned char)' Error: Unresolved external symbol, function:SysiSleep Error: Unresolved external function:'Sys_Yield(void)' Error: Unresolved external symbol, function:Sys_Yield Error: Unresolved external function:'SysiSleep(unsigned char)' Error: Unresolved external symbol, function:SysiSleep Error: Unresolved external function:' failure Sys_Yield(void)' Error: Unresolved external symbol, function:Sys_Yield Error: Unresolved external function:'SysInit(void)' Error: Unresolved external symbol, function:SysInit Error: Unresolved external function:'SysiCreateTask(unsigned char,unsigned char,unsigned char)' Error: Unresolved external symbol, function:SysiCreateTask Error: Unresolved external function:'SysiCreateTask(unsigned char,unsigned char,unsigned char)' Error: Unresolved external symbol, function:SysiCreateTask Error: Unresolved external function:'SysiCreateTask(unsigned char,unsigned char,unsigned char)' Error: Unresolved external symbol, function:SysiCreateTask Error: Unresolved external function:'SysStartTask(unsigned char)' Error: Unresolved external symbol, function:SysStartTask Error: Unresolved external function:'SysStartTask(unsigned char)' Error: Unresolved external symbol, function:SysStartTask Error: Unresolved external function:'SysStartTask(unsigned char)' Error: Unresolved external symbol, function:SysStartTask Error: Unresolved external function:'Sys_Yield(void)' Error: Unresolved external symbol, function:Sys_Yield Done
  8. Hi there! the virtual members of class works fine , but a abstract don't work. what is needed to make this running like a abstract classes? thanks Douglas
  9. thank you a lot Mr. Pavel, this works fine now, but I have to put the struct on inside the union to take the effect that I hope, is this a BoostC++ limitation or a normal behavior of C++ ? #include <i2c_driver.h> /* * * * * * * * * * * * * * * * * * * * * * * i2c hardwareware argumentos da template * * * * * * * * * * * * * * * * * * * * * */ #define i2c_ARGS 3, e_PORT, e_TRIS, 4, e_PORT, e_TRIS, \ e_SSPCON, e_SSPCON2, e_SSPSTAT, e_SSPBUF, \ e_SSPIF, e_PIR2, e_BCLIF, e_PIR2, 7, e_SSPADD,\ (i2c_reset_wdt | i2c_SMP |i2c_HW) // variaveis nano pondem ser passadas como argumentos de template. As seguintes constantes mapea // os registros do PIC e os registros i2c do PIC. Estas constantes sao entao usadas pela funcao template. #define e_PORT PORTC #define e_TRIS TRISC #define e_SSPCON SSPCON #define e_SSPCON2 SSPCON2 #define e_SSPSTAT SSPSTAT #define e_SSPADD SSPADD #define e_SSPBUF SSPBUF #define e_PIR1 PIR1 #define e_PIR2 PIR2 #define e_SSPIF SSPIF #define e_BCLIF BCLIF //////////////////////////////////////////////////////////////////////////// // I2C MCP23016 expander de portas I/O //////////////////////////////////////////////////////////////////////////// #define gp0 0x00 //Porta GP0 #define olat0 0x02 // #define ipol0 0x04 //registrador de polaridade de entrada do GP0 #define iodir0 0x06 //registrador que define como entrada ou saida GP0 #define intcap0 0x08 //registrador de captura de interrupcao do GP0 #define iocon0 0x0a //registrador para velocidade de amostragem de interrupcao AIRES0 //definicoes dos enderecos dos escravos com os comandos de leitura ou escita #define slave_1 0b01000000//endereco do escravo 1 comando de escrita + 1 leitura #define slave_2 0b01000010//endereco do escravo 2 comando de escrita + 1 leitura #define slave_3 0b01000100//endereco do escravo 3 comando de escrita + 1 leitura #define slave_4 0b01000110//endereco do escravo 4 comando de escrita + 1 leitura #define slave_5 0b01001000//endereco do escravo 5 comando de escrita + 1 leitura #define slave_6 0b01001010//endereco do escravo 6 comando de escrita + 1 leitura #define slave_7 0b01001100//endereco do escravo 7 comando de escrita + 1 leitura #define slave_8 0b01001110//endereco do escravo 8 comando de escrita + 1 leitura class Cmcp23016{ public: Cmcp23016();//construtor Cmcp23016(unsigned char);//inicialzar os mcp23016 passados por parametros no de 1 a 8 dispositivos ~Cmcp23016(); void Write_MCP23016(unsigned char SlaveAddr, unsigned char CommandByte, unsigned char Lsb, unsigned char Msb); void Read_MCP23016(unsigned char SlaveAddr, unsigned char CommandByte); void config_mcp(unsigned char slave); void esc_dados(unsigned char, unsigned char); private: unsigned char m_ucVarGp0;//varialvel do byte baixo do mcp23016 unsigned char m_ucVarGp1;//varialvel do byte alto do mcp23016 union Converse { int Gp; struct DoisBytes{ unsigned char ucLsb; unsigned char ucMsb; }Gp0e1; }Totaliza; }; Thanks!
  10. Hi! I make a attempt to put a structure in a class and then shows this error message "missing right brace". are not accepted structures as member of class? thanks! class Cmcp23016{ public: Cmcp23016(); Cmcp23016(int); ~Cmcp23016(); void WriteMcp23016(int iSlaveAddr, int iCommandByte, int iLsb, int iMsb); void LeMcp23016(int iSlaveAddr, int iCommandByte); void config_mcp(int slave); private: int m_iVarGp0;//varialvel do byte baixo do mcp23016 int m_iVarGp1;//varialvel do byte alto do mcp23016 struct DoisBytes{// the message error highlighting this line unsigned char iLsb; unsigned char iMsb; }; union Converse { int Gp; struct DoisBytes Gp0e1; }Totaliza; };
  11. thanks for reply! I understand now, very thanks Mr. Pavel! but I have another question about this, when in debugging this code works like nothing occurs with f11 key, treats the function like normal of a object declared,going within the functions members and so on... but it is deleted. is correct this behavior at debug time? I'm sending the code for analizes. thanks. Speaking formally acces of a deleted object leads to unpredicted behaviour. This means that code may work but it also may crash. Going deeper in your particular case when an object is deleted compiler just cleares flag used by allocation code to check if a piece of memory is free or occupied. This means that all object data is not touched at the deletion point and if accessed it appeares that everything object is still there and works just fine. However this will work only till another object is placed at this location and overwrites old data left from previous object. As a programmer when you delete an object you should always assume that this object does not exist any longer and do not access any of its data. Regards, Pavel Thank you Mr. Pavel! Douglas
  12. thanks for reply! I understand now, very thanks Mr. Pavel! but I have another question about this, when in debugging this code works like nothing occurs with f11 key, treats the function like normal of a object declared,going within the functions members and so on... but it is deleted. is correct this behavior at debug time? I'm sending the code for analizes. thanks.
  13. Hi! why do the compiler accept the object "texto" after delete it? should issue a warning or erro message to attempt access a memory that not exist a object ? void main() { //texto.portada_lcd(); while(1){ class Ctexto *texto = new class Ctexto; port.Toggle(); pinB0=0; texto.texto2(); delete texto;//destroy object texto=NULL;// texto.texto2();// forced erro. work fine don't issues erro code or warnings } } thanks Douglas
  14. Hi! I'm new in BoostC++ programation, and I make a attempt put my programs within a class, but when I compile the programa show this mistake erro: too many arguments in function call the function is this delay_us(1); and I make my code in separate file and included in a principal file , and pragma CLOCK_FREQ 4000000 is declared too. what's wrong? thanks!
×
×
  • Create New...