Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Oshonsoft LCD Setup

Status
Not open for further replies.

aljamri

Member
Trying to simulate NG Analogue Tutorial eleven, loaded 11.3, (tested it in reality and worked fine), I tried to connect the LCD and changed the analog input but LCD seems not working, and error message appears as in the attached shot.
 

Attachments

  • os.JPG
    os.JPG
    168.3 KB · Views: 517
Thank you Ian,

The LCD got connected, but the ADC seems for me not working. I've just adjust both analog channels. the result attached picutre

edit: it works, it seems that i'm not timming correctly:) thank you Ian
 

Attachments

  • os2.JPG
    os2.JPG
    152.9 KB · Views: 443
Last edited:
hi aljamri,

From viewing your images you seem to have PORTB high set as the 4 LCD data lines, yet you are using them also as control lines..?????


Set interface: 4 bit Low on the selection window.
 
Last edited:
hi,
Post your Oshonsoft *.bas file.

EDIT:
Do you have this statement in your header

ADCON1 = 0x84
it sets all PORTA as adc
 
Last edited:
Sorry Ian, Sorry Eric, I was busy trying to get it work, so I've not noticed your posts.

Finally with your help I've got it working. Only I could not change the reference voltage as per NG analogue board so instead of 2v input I'm getting 4v on LCD.

Eric: where to get Oshonsoft *.bas file. ?


Thank you for all
 
forgot the attachment :) my bedtime (old people symptoms):D
 

Attachments

  • os3.JPG
    os3.JPG
    169.3 KB · Views: 396
Yep!! Tested with Oshonsoft simulator! Works OK. Did you compile the tutorial using MPASMWIN option and load the hex manually?


Forget this post then... I never refreshed since my last post...

Eric thought you were programming in basic (So did I until I re-read your OP)


It looks to me as if the program uses VREF..
 
Last edited:
If I knew you had Oshonsoft simulator then, I would have suggested you compile directly with this program...

The ADCON1 reg in this example is set to 6.. I could do with being 2 or 4 as the Vref isn't set to anything. (for the real device that is)
 
Yes, in "Reading 4 - 20 mA on LCD using PIC16F876A", Eric told in post #7 that I can remove the bottom end +1V offset in the program, to get a Span of 4V.
I postpone asking him HOW, for future. Is that sort of what you Ian talking about ?
hi aljamri
If you are using the full 10 bits of the adc, ie 1023decimal and the Vadc max is 5V
To subtract the 1Vdc offset you need to subtract [1/5] *1023 = 205 from the reading.
This will give a value of 0 thru 818 for 0V to 4V

If you set the resistor driving the adc input for a maximum of 4.89V
you will get [4.89/5]*1023 = ~1000 counts, then subtract 200 to leave 800 counts which represents 4V input.
 
Last edited:
By the way... There is now a java based PIC assembler..http://frederic.pitoizet.pagesperso-orange.fr/eng/picasm.html Haven't tried it myself, but it looks good

As I'm not aware about JAVA application and the site owner was giving early warning that he well not accept any questions in this regards, I prefer OshonSoft and if Protuse not of huge size, it would be my first choice.

Anyway, I've got a fresh question about OshonSoft and I do not know, shall I start a new thread or continue in this. I'll start here and waiting for any advise to make a new one.

My Question is regarding a suggested ADC routine by be80b2 in " https://www.electro-tech-online.com/threads/reading-4-20-ma-on-lcd-using-pic16f876a.119563/ " post #17. When I made the circuit, the LCD shows only square, so I thought of my hardware problem, so that I decided to simulate it with OshonSoft and see what is the result. It seems the routine is updating LCD port PORTB one time, and then it goes for endless loop without updating it any more. The attached picture shows the result
 

Attachments

  • os3.JPG
    os3.JPG
    169.3 KB · Views: 402
hi aljamri,
Please post the full code and I will check it out on Oshonsoft.
 
Last edited:
Sorry, wrong attachment, whenever I want to edit my post, it did not go for Advanced.

EDIT: Hi Eric here is the code:

Code:
char message1[] = "ADC Value= ";
 char *value = "0000";
 unsigned int ADC_Value;
void main() {
  ADCON0 = 0b11000000;
  ADCON1 = 0b10001111;
  TRISA  = 0xFF;              // PORTA is input
  TRISB  = 0;                 // PORTB is output
  Lcd_Init(&PORTB);                 // Initialize LCD

  do {
       adc_value = ADC_Read(0);
   value[0] = adc_value/1000 + 48; // Add 48 to get character value
   value[1] = (adc_value/100)%10 + 48;
   value[2] = (adc_value/10)%10 + 48;
   value[3] = adc_value%10 + 48;
   Lcd_Out(1,11,value);
   Delay_ms(2000);
  } while(1);
}
 

Attachments

  • OS4.JPG
    OS4.JPG
    170.1 KB · Views: 385
Last edited:
OOPs, sorry, I don't know how to get Oshon code.
 
Status
Not open for further replies.

New Articles From Microcontroller Tips

Back
Top