![]() | ![]() | ![]() |
| | |||||||
| Micro Controllers Discuss all aspects of micro controllers - building them, coding them, etc. All controllers are welcome - PIC, BASIC, Z8 Encore!, etc. |
| | LinkBack | Thread Tools | Display Modes |
| | (permalink) |
| Hello, I am new to microcontrollers. I am using MikroC and the OshonSoftware simulator. I am trying to display some text on the LCD module of the simulator. I am able to get to work if I complile my code using a 16F877, but it does not work if I compile as a 16F88. This is what I am using as code: void main(){ TRISB = 0x00; LCD_INIT(&PORTB); LCD_CMD(LCD_CLEAR); LCD_OUT(1,1,"A"); } I have the LCD display set using 2 x 16, PORTB as data, interface 4-bit high, RS line PORTB 2, E line PORTB 3, RW not used. I would like to get it to work with 16F88, as that is what I have on hand. Thank you. | |
| |
| | (permalink) |
| have you specified 16f88 in compiler before you compile and oshonsoft sim. before you load the subsequent hex file? | |
| |
| | (permalink) |
| Hi, Have you disabled analogue input? RB6 and RB7 are also used as analogue input pins, AN5 and AN6. They are set as analog in default.
__________________ Superman returns.. | |
| |
| | (permalink) |
| monkeybiter, yes, I set the compiler to 16F88. The simulator gives an error if I don't. I have made the leds blink using the 16F88 with this simulator. bananasiong, I thought the 'TRISB = 0x00;' sets PORTB as output. Thanks for the quick replies. | |
| |
| | (permalink) |
| Hi, You don't you give a try to disable the analog input? I've simulated using MPLAB, I think the priority is given to the analog select register. After occurance of any reset, ANSEL will all be set.
__________________ Superman returns.. | |
| |
| | (permalink) | |
| Quote:
| ||
| |
| | (permalink) |
| Forgive my ignorance, but how do I do that? I did manage to get it to display some characters, although not what I wanted. I copied the code from the MikroC user's manual. | |
| |
| | (permalink) | |
| Quote:
| ||
| |
| | (permalink) |
| Hi, Read the datasheet under analog to digital conversion. There is a register called ANSEL that allow you to select from AN0 to AN6 whether is digital I/O or analog I/O. 0 for digital and 1 for analog, the default is 1. If you're not using any analog input, simply clear them. Just like setting the port direction, TRISB.
__________________ Superman returns.. | |
| |
| | (permalink) |
| Try, ANSEL = 0x00; Analogue inputs still work as digital outputs but always read back as 0. This is fine for a lot of things but when you just setting bits it can cause problems. You would also get problems reading the status of the LCD which explains your corrupted characters. Mike. | |
| |
| | (permalink) |
| Thank you all for your replies and patience. Adding ANSEL = 0x00; to my code worked. Looks like I have a lot of reading ahead. | |
| |
| | (permalink) |
| Don't worry about it too much, everyone, and I do mean everyone, gets caught out by the analogue inputs being the default. Mike. | |
| |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
| |
| | ||||
| Title | Starter | Forum | Replies | Latest |
| High ADC sampling rate PIC, 18F needed? | bananasiong | Micro Controllers | 24 | 28th October 2007 01:13 PM |
| Greetings. A pic controlled traffic light circuit... | Wiley | Electronic Projects Design/Ideas/Reviews | 2 | 13th October 2007 05:46 PM |
| Battery Tester with a PIC 16F818 Cicuit Question | dmarciano | Micro Controllers | 1 | 9th October 2007 05:41 AM |
| Battery Tester with a PIC 16F818 Cicuit Question | dmarciano | Micro Controllers | 1 | 9th October 2007 04:55 AM |
| Four PIC with One LCD.. | meera83 | Micro Controllers | 13 | 20th September 2007 07:40 AM |