Jump to content

lcd

EstablishedMember
  • Content Count

    20
  • Joined

  • Last visited

Everything posted by lcd

  1. Hi asmallri: I did it! Thank you very much!
  2. Great tutorial! I'll try it. by the way, what is 'hey presto' ? Thanks.
  3. For example: I have an array variable ary[0] ~ ary[9] that located in PIC RAM and I want to display the content of, say, ary[3] on LCD. Then I can use "lprintf("%d", ary[3]);" to do it. Now, if I want to transmit the content of ary[3] to PC computer via RS232, how can I do this? Since I am a beginner, it is not easy for me to figure out how to use the function primatives in rs232_driver.c. Thanks.
  4. Great! Thank you so much. asmallri. It is working now. But the functionality of this RS232 driver is so restricted such that I could not transmit a variable number to the PC.
  5. Hi Asmallri, Thank you for your anwser. I made two modifications: 1: comment out the line: bit_time thing. 2: change uart_init(1,21); to uart_init(1,25); Then after rebuild it, I got the things below. It looks that the "bit_time" is needed. Clean: Deleting intermediary and output files. Clean: Done. Executing: "C:\Program Files\SourceBoost\boostc.pic16.exe" try3.c -O1 -W1 -t 16F877A BoostC Optimizing C Compiler Version 2.2.5 Beta (for PIC16 architecture) http://www.picant.com/c2c/c.html Copyright© 2004-2005 Pavel Baranov Copyright© 2004-2005 David Hobday C:\Program Files\SourceBoost\include/rs232_driver.h(307:21): error: unknown identifier 'bit_time' C:\Program Files\SourceBoost\include/rs232_driver.h(307:20): error: failed to generate expression C:\Program Files\SourceBoost\include/rs232_driver.h(307:20): error: invalid operand '-bit_time' C:\Program Files\SourceBoost\include/rs232_driver.h(307:30): error: failed to generate expression C:\Program Files\SourceBoost\include/rs232_driver.h(307:30): error: invalid operand '+ ' C:\Program Files\SourceBoost\include/rs232_driver.h(307:36): error: failed to generate expression C:\Program Files\SourceBoost\include/rs232_driver.h(307:36): error: invalid operand '/' C:\Program Files\SourceBoost\include/rs232_driver.h(307:17): error: failed to generate expression C:\Program Files\SourceBoost\include/rs232_driver.h(307:17): internal error: failed to generate 'for' expression C:\Program Files\SourceBoost\include/rs232_driver.h(317:21): error: unknown identifier 'bit_time' C:\Program Files\SourceBoost\include/rs232_driver.h(317:20): error: failed to generate expression C:\Program Files\SourceBoost\include/rs232_driver.h(317:20): error: invalid operand '-bit_time' C:\Program Files\SourceBoost\include/rs232_driver.h(317:30): error: failed to generate expression C:\Program Files\SourceBoost\include/rs232_driver.h(317:30): error: invalid operand '*' C:\Program Files\SourceBoost\include/rs232_driver.h(317:32): error: failed to generate expression C:\Program Files\SourceBoost\include/rs232_driver.h(317:32): error: invalid operand '/' C:\Program Files\SourceBoost\include/rs232_driver.h(317:36): error: failed to generate expression C:\Program Files\SourceBoost\include/rs232_driver.h(317:36): error: invalid operand '/' C:\Program Files\SourceBoost\include/rs232_driver.h(317:17): error: failed to generate expression C:\Program Files\SourceBoost\include/rs232_driver.h(317:17): internal error: failed to generate 'for' expression C:\Program Files\SourceBoost\include/rs232_driver.h(353:21): error: unknown identifier 'bit_time' C:\Program Files\SourceBoost\include/rs232_driver.h(353:20): error: failed to generate expression C:\Program Files\SourceBoost\include/rs232_driver.h(353:20): error: invalid operand '-bit_time' C:\Program Files\SourceBoost\include/rs232_driver.h(353:30): error: failed to generate expression C:\Program Files\SourceBoost\include/rs232_driver.h(353:30): error: invalid operand '+' C:\Program Files\SourceBoost\include/rs232_driver.h(353:34): error: failed to generate expression C:\Program Files\SourceBoost\include/rs232_driver.h(353:34): error: invalid operand '/' C:\Program Files\SourceBoost\include/rs232_driver.h(353:17): error: failed to generate expression C:\Program Files\SourceBoost\include/rs232_driver.h(353:17): internal error: failed to generate 'for' expression C:\Program Files\SourceBoost\include/rs232_driver.h(361:21): error: unknown identifier 'bit_time' C:\Program Files\SourceBoost\include/rs232_driver.h(361:20): error: failed to generate expression C:\Program Files\SourceBoost\include/rs232_driver.h(361:20): error: invalid operand '-bit_time' C:\Program Files\SourceBoost\include/rs232_driver.h(361:30): error: failed to generate expression C:\Program Files\SourceBoost\include/rs232_driver.h(361:30): error: invalid operand '+' C:\Program Files\SourceBoost\include/rs232_driver.h(361:34): error: failed to generate expression C:\Program Files\SourceBoost\include/rs232_driver.h(361:34): error: invalid operand '/' C:\Program Files\SourceBoost\include/rs232_driver.h(361:17): error: failed to generate expression C:\Program Files\SourceBoost\include/rs232_driver.h(361:17): internal error: failed to generate 'for' expression C:\Program Files\SourceBoost\include/rs232_driver.h(370:21): error: unknown identifier 'bit_time' C:\Program Files\SourceBoost\include/rs232_driver.h(370:20): error: failed to generate expression C:\Program Files\SourceBoost\include/rs232_driver.h(370:20): error: invalid operand '-bit_time' C:\Program Files\SourceBoost\include/rs232_driver.h(370:30): error: failed to generate expression C:\Program Files\SourceBoost\include/rs232_driver.h(370:30): error: invalid operand '+' C:\Program Files\SourceBoost\include/rs232_driver.h(370:34): error: failed to generate expression C:\Program Files\SourceBoost\include/rs232_driver.h(370:34): error: invalid operand '/' C:\Program Files\SourceBoost\include/rs232_driver.h(370:17): error: failed to generate expression C:\Program Files\SourceBoost\include/rs232_driver.h(370:17): internal error: failed to generate 'for' expression C:\Program Files\SourceBoost\include/rs232_driver.h(444:21): error: unknown identifier 'bit_time' C:\Program Files\SourceBoost\include/rs232_driver.h(444:20): error: failed to generate expression C:\Program Files\SourceBoost\include/rs232_driver.h(444:20): error: invalid operand '-bit_time' C:\Program Files\SourceBoost\include/rs232_driver.h(444:30): error: failed to generate expression C:\Program Files\SourceBoost\include/rs232_driver.h(444:30): error: invalid operand '/' C:\Program Files\SourceBoost\include/rs232_driver.h(444:17): error: failed to generate expression C:\Program Files\SourceBoost\include/rs232_driver.h(444:17): internal error: failed to generate 'for' expression failure BUILD FAILED: Mon May 16 13:24:42 2005 By the way, why the configuration declairation list below is not needed in this code? #ifdef _PIC16 #pragma DATA _CONFIG, _CP_OFF & _PWRTE_OFF & _WDT_OFF & _HS_OSC #else #pragma DATA _CONFIG1H, _OSCS_OFF_1H & _HS_OSC_1H #pragma DATA _CONFIG2L, _BOR_ON_2L & _BORV_20_2L & _PWRT_OFF_2L #pragma DATA _CONFIG2H, _WDT_OFF_2H & _WDTPS_128_2H #pragma DATA _CONFIG3H, _CCP2MX_ON_3H #pragma DATA _CONFIG4L, _STVR_ON_4L & _LVP_OFF_4L & _DEBUG_OFF_4L #pragma DATA _CONFIG5L, _CP0_OFF_5L & _CP1_OFF_5L & _CP2_OFF_5L & _CP3_OFF_5L #pragma DATA _CONFIG5H, _CPB_OFF_5H & _CPD_OFF_5H #pragma DATA _CONFIG6L, _WRT0_OFF_6L & _WRT1_OFF_6L & _WRT2_OFF_6L & _WRT3_OFF_6L #pragma DATA _CONFIG6H, _WRTC_OFF_6H & _WRTB_OFF_6H & _WRTD_OFF_6H #pragma DATA _CONFIG7L, _EBTR0_OFF_7L & _EBTR1_OFF_7L & _EBTR2_OFF_7L & _EBTR3_OFF_7L #pragma DATA _CONFIG7H, _EBTRB_OFF_7H #endif Thanks.
  6. Hi, I am trying the rs232 using 16f877a @4MHz Hardware USART. It is not working. My code is below. From comment in rs232_driver.h, it seems that "bit_time" is only for software usart. I am using hardware part, why do I have to use it? Thanks. #include <system.h> #include <icd2.h> #define bit_time 104 // 9600 baud at 4MHz // PIC16F87x defaults for hardware USART support #define TX_PORT 0x07 #define TX_TRIS 0x87 #define TX_BIT 6 #define RX_PORT 0x07 #define RX_TRIS 0x87 #define RX_BIT 7 #define e_SPBRG 0x99 #define e_RCREG 0x1a #define e_TXREG 0x019 #define e_TXSTA 0x98 #define e_RCSTA 0x18 #define e_TXIF_PIR 0x0c #define e_RCIF_PIR 0x0c #define e_TXIF_BIT 4 #define e_RCIF_BIT 5 #define MODE (USART_reset_wdt | USART_HW) #include <rs232_driver.h> #pragma CLOCK_FREQ 4000000 void main() { uart_init(1,21); puts("abcdefghijklm"); while (1) { if (kbhit()) { putc(getc()); } } }
  7. Can I connect lcd's data pins to other pins of port X except 4,5,6,7, for example pic16f877A port D 3,4,5,6 pins, using lcd_driver.c?
  8. The reason lprintf is used in IRS is because I want to use button RB0 interruption to trigger the display of the data A/D gathered.
  9. I can use lprintf in main without problem. But when I use it in interrupt, the message comes.
  10. When I use lprintf function, I got message: Failed to load ......\xxx.COF. What's the reason?
  11. Why I could not find the ADCS2 bit defined in ADCON1 register in pic16F877A.h file?
  12. post your code here such that one can help you.
  13. The things bother me a lot are not the c syntax but the header file included in the boostC source file. For example, how can I know what PIC microcontroller is being used in "lcd.c" file. Don't tell me that I can get it from comment. It seems that the inluded file "system.h" has the answer. But I am not able to trace it till getting a conclusion. Also, I am trying to analyze this part of code: #ifdef _PIC16 #pragma DATA _CONFIG, _CP_OFF & _PWRTE_OFF & _WDT_OFF & _HS_OSC #else #pragma DATA _CONFIG1H, _OSCS_OFF_1H & _HS_OSC_1H #pragma DATA _CONFIG2L, _BOR_ON_2L & _BORV_20_2L & _PWRT_OFF_2L #pragma DATA _CONFIG2H, _WDT_OFF_2H & _WDTPS_128_2H #pragma DATA _CONFIG3H, _CCP2MX_ON_3H #pragma DATA _CONFIG4L, _STVR_ON_4L & _LVP_OFF_4L & _DEBUG_OFF_4L #pragma DATA _CONFIG5L, _CP0_OFF_5L & _CP1_OFF_5L & _CP2_OFF_5L & _CP3_OFF_5L #pragma DATA _CONFIG5H, _CPB_OFF_5H & _CPD_OFF_5H #pragma DATA _CONFIG6L, _WRT0_OFF_6L & _WRT1_OFF_6L & _WRT2_OFF_6L & _WRT3_OFF_6L #pragma DATA _CONFIG6H, _WRTC_OFF_6H & _WRTB_OFF_6H & _WRTD_OFF_6H #pragma DATA _CONFIG7L, _EBTR0_OFF_7L & _EBTR1_OFF_7L & _EBTR2_OFF_7L & _EBTR3_OFF_7L #pragma DATA _CONFIG7H, _EBTRB_OFF_7H #endif I could not come up a conclusion whether the first line "#ifdef _PIC16" is true of not. please help me. thanks!
  14. anyone tried this: when you drag the workspace frame to somewhere else, you can never put it back as default status.
  15. Hi dave, I figured out how the single number bit notation works. Please just tell my 1st question. Thanks.
  16. 1. Now that adc is defined for nothing, why bother to define it? 2.Both each memory location and register has 8 bits. It makes sense that each bit of memory location could be correspondind to each bit of the register.(by notation @0x40.2, although I don't know the mechanism of '.' here. it might be defined by the compiler). Also, for example, PIC16F877 PORTB is defined by datasheet at 06h. There is no infomation where bit2 of PORTB is defined. If by single number notation, bit2 PORTB is located at 32h, can we write a '1' to memory 32h to put PORTB bit2 to high? Obviously, we'll fail to do it. I am still confused.
  17. Hi Dave, Could you explain: bit b2@0x202; //variable located at bit 2 of register 0x40 (0x40*8 + 2) why b2 which belong to register 0x40 is located at (0x40*8+2)? Thanks.
  18. Thanks for reply. All the c references say that #define can by used in two cases: 1. for example: #define AAA 1234. it means that AAA is equivalent to 1234. 2. macro defination: for example: #define AAA(x) func(x) but here, the "#define _BOOSTC_H_" does not belong to either case above. What does it mean?
  19. for example: in boostc.h file, why using _ (underscore) in front of the word BOOSTC_H_? #ifndef _BOOSTC_H_ #define _BOOSTC_H_ I saw many such kind writtings not only in this header file. I guess it has some special purpose. I don't know what is going on here. In addition, is sign @ define by ANSI C? why I can not find such a sign in ANSI C reference? Thanks!
×
×
  • Create New...