Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

[SOLVED] Why this One Wire LCD not working ?

Status
Not open for further replies.

milan.rajik

Banned
Joined
Apr 1, 2013
Messages
2,528
Helped
540
Reputation
1,078
Reaction score
524
Trophy points
1,393
Activity points
0
Why this One Wire LCD not working ?

My Project is One Wire Serial LCD. I have used PIC12F683 with XT 4 MHz Oscillator. I am testing in both Proteus and hardware and I am getting garbage on LCD.

I am posting two projects. One is Roman Black's project which someone has made it successfully and it is working. Another is my project which is mikroC PRO PIC project and it is not working. It is printing garbage on LCD. I have used Roman Black's C Code to make my mikroC code.


Links that I have referred to.

https://320volt.com/en/one-wire-lcd/

https://developer.mbed.org/cookbook/1-wire-shifting-2x16-LCD

https://developer.mbed.org/users/ahmetunal/code/1WireLcd/

https://www.romanblack.com/shift1.htm

https://www.romanblack.com/shift1/sh1_projects.htm

https://www.instructables.com/id/low-cost-1-wire-lcd-for-8-pin-micro-controllers-ro/

The image shows working project made by someone based on Roman Black's code and circuit.

Roman Black's Circuit.

118696d1434960377-f2ifx3bhly7fhw5.jpg


Roman Black's Circuit implemented by someone.

118697d1434960379-one-wirs-lcd.png


My Circuit

118702d1434960594-ow-lcd.png



There was a mistake in my code. I have fixed it but still it is not working.


Code C - [expand]
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
#define _LCD_FIRST_ROW          0x80         //Move cursor to the 1st row
#define _LCD_SECOND_ROW         0xC0         //Move cursor to the 2nd row
#define _LCD_THIRD_ROW          0x94         //Move cursor to the 3rd row
#define _LCD_FOURTH_ROW         0xD4         //Move cursor to the 4th row
#define _LCD_CLEAR              0x01         //Clear display
#define _LCD_RETURN_HOME        0x02         //Return cursor to home position, returns a shifted display to
                                                 //its original position. Display data RAM is unaffected.
#define _LCD_CURSOR_OFF         0x0C         //Turn off cursor
#define _LCD_UNDERLINE_ON       0x0E         //Underline cursor on
#define _LCD_BLINK_CURSOR_ON    0x0F          //Blink cursor on
#define _LCD_MOVE_CURSOR_LEFT   0x10          //Move cursor left without changing display data RAM
#define _LCD_MOVE_CURSOR_RIGHT  0x14           //Move cursor right without changing display data RAM
#define _LCD_TURN_ON            0x0C         //Turn Lcd display on
#define _LCD_TURN_OFF           0x08         //Turn Lcd display off
#define _LCD_SHIFT_LEFT         0x18         //Shift display left without changing display data RAM
#define _LCD_SHIFT_RIGHT        0x1E         //Shift display right without changing display data RAM
 
sbit One_Wire at GP0_bit;
sbit One_Wire_Direction at TRISIO0_bit;
 
//Function Prototypes
void One_Wire_LCD_Init();
void One_Wire_LCD_Cmd(char out_char);
void One_Wire_LCD_Chr(char row, char col, char out_char);
void One_Wire_LCD_Chr_Cp(char out_char);
void One_Wire_LCD_Out(char row, char col, char *str);
void One_Wire_LCD_Out_Cp(char *str);
void WriteNibble(char nib, char rs);
 
unsigned char RS;
unsigned char msg1[] = "One-Wire LCD";
unsigned char msg2[] = "4 bit";
unsigned char msg3[] = "20x4";
unsigned char msg4[] = "HD44780";
 
void Delay_6ms() {
    Delay_ms(6);
}
 
void Delay_15us() {
    Delay_us(11);
}
 
void One_Wire_LCD_Cmd(char out_char) {
    char rs = 0;
    
    WriteNibble(out_char, rs);
    Delay_ms(50);
}
 
 
void One_Wire_LCD_Chr(char row, char col, char out_char) {
    char rs = 1;
    
    switch(row){    
            case 1:
                One_Wire_LCD_Cmd(0x80 + col-1);
                break;
            case 2:
                One_Wire_LCD_Cmd(0xC0 + col-1);
                break;
            case 3:
                One_Wire_LCD_Cmd(0x94 + col-1);
                break;
            case 4:
                One_Wire_LCD_Cmd(0xD4 + col-1);
                break;
    }   
                             
    WriteNibble(out_char, rs);    
}
 
void One_Wire_LCD_Chr_Cp(char out_char) {    
    char rs = 1;
                             
    WriteNibble(out_char, rs);    
}
 
void One_Wire_LCD_Out(char row, char col, char *str) {        
    while(*str)
        One_Wire_LCD_Chr(row,col++,*str++);       
}
 
void One_Wire_LCD_Out_Cp(char *str) {        
    while(*str)
        One_Wire_LCD_Chr_Cp(*str++);       
}
 
void Send_Byte(char out_char, char rs) {
    char i = 0, mask = 0x80;
    
    out_char.F2 = rs;        
    
    for(i = 0; i < 7; i++) {    // send all 7 bits
        if(out_char & mask) {   // if HI bit, make 1uS low pulse
             One_Wire = 0;  // make LO pulse
             One_Wire = 1;      // end LO pulse
             Delay_15uS();      // safe 15uS pulse recovery
        }
        else {          // else is LO bit!
             One_Wire = 0;          
             Delay_15uS();      // 15uS LO pulse
             One_Wire = 1;          
             Delay_15uS();  // 30uS recovery
             Delay_15uS();  
        }
        // now we have sent that bit out using Shift1 timed protocol!
        mask >>= 1;             // get the next bit
               
    }
    
    // The Shift1 protocol requires that the 8th bit is very
    // long, this causes the 74HC595 shift register to latch
    // all the 8 bits to its output port.
    // NOTE! the 8th bit (bit0) will always be received as zero.
    One_Wire = 0;   // send 8th bit, lo pulse = 14x15 = 210uS           
    for(i = 14; i; i--)Delay_15uS();  
    One_Wire = 1;   // and hi recovery 20x15 = 300 uS       
    for(i = 20; i; i--)Delay_15uS();   
}
 
void WriteNibble(char out_char, char rs) {
     char dummy;
     
     dummy = out_char & 0xF0;
     
     dummy.F3 = 1;
     Send_Byte(dummy, rs);
     dummy.F3 = 0;
     Send_Byte(dummy, rs);
     
     dummy = out_char & 0x0F;
     dummy <<= 4;
     dummy.F3 = 1;
     Send_Byte(dummy, rs);
     dummy.F3 = 0;
     Send_Byte(dummy, rs);
}
 
void One_Wire_LCD_Init() {
    Delay_ms(150);
    One_Wire_LCD_Cmd(0x30);
    Delay_ms(30);
    One_Wire_LCD_Cmd(0x30);
    Delay_ms(30);
    One_Wire_LCD_Cmd(0x30);
    Delay_ms(30);
    One_Wire_LCD_Cmd(0x20);
    Delay_ms(20);
    One_Wire_LCD_Cmd(0x28);   
    Delay_ms(10);
    One_Wire_LCD_Cmd(0x0C);   
    Delay_ms(10);
    One_Wire_LCD_Cmd(0x06);  
    Delay_ms(10);
    One_Wire_LCD_Cmd(0x0C);
    Delay_ms(10);
}
 
void main() {
 
     ANSEL = 0x00;
     TRISIO = 0x00;
     GPIO = 0x00;
 
     One_Wire_LCD_Init();
     One_Wire_LCD_Cmd(_LCD_CLEAR);
     One_Wire_LCD_Cmd(_LCD_CURSOR_OFF);
 
     One_Wire_LCD_Out(1,1,"One-Wire");
     One_Wire_LCD_Out(2,1,"Serial LCD");
     One_Wire_LCD_Out(3,1,"20X4");
     One_Wire_LCD_Out(4,1,"Using 74HC595");
     
     while(1){
          ;
     }
}

 

Attachments

  • F2IFX3BHLY7FHW5.jpg
    F2IFX3BHLY7FHW5.jpg
    96 KB · Views: 39
  • one wirs lcd.png
    one wirs lcd.png
    31.8 KB · Views: 38
  • One Wire LCD not working.rar
    37.2 KB · Views: 5
  • one-wire-lcds.rar
    32.2 KB · Views: 5
  • ow lcd.png
    ow lcd.png
    29.2 KB · Views: 38
Last edited:

betwixt

Super Moderator
Staff member
Joined
Jul 4, 2009
Messages
14,931
Helped
4,874
Reputation
9,766
Reaction score
4,662
Trophy points
1,393
Location
Aberdyfi, West Wales, UK
Activity points
127,018
The design uses the time constant of the RC networks to set the pulse widths and overlap. The timing is critical so you must use exact component values and exact pulse widths from the PIC. The only sure way to debug it is to measure the pulses at the inputs to the 74LS595. The logic level threshhold is also important, you may find some makes of LS595 work better than others.

Brian.
 

milan.rajik

Banned
Joined
Apr 1, 2013
Messages
2,528
Helped
540
Reputation
1,078
Reaction score
524
Trophy points
1,393
Activity points
0
@betwixt

I have use the exact same circuit used here.

https://320volt.com/en/one-wire-lcd/

Only difference is my PIC is different. He has used Roman Black's code. I am also using Roman Black's code. The original code is also made for 4 MHz XT crystal and I am also using the same.

This is my new code.


Code C - [expand]
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
#define _LCD_FIRST_ROW          0x80         //Move cursor to the 1st row
#define _LCD_SECOND_ROW         0xC0         //Move cursor to the 2nd row
#define _LCD_THIRD_ROW          0x94         //Move cursor to the 3rd row
#define _LCD_FOURTH_ROW         0xD4         //Move cursor to the 4th row
#define _LCD_CLEAR              0x01         //Clear display
#define _LCD_RETURN_HOME        0x02         //Return cursor to home position, returns a shifted display to
                                                 //its original position. Display data RAM is unaffected.
#define _LCD_CURSOR_OFF         0x0C         //Turn off cursor
#define _LCD_UNDERLINE_ON       0x0E         //Underline cursor on
#define _LCD_BLINK_CURSOR_ON    0x0F          //Blink cursor on
#define _LCD_MOVE_CURSOR_LEFT   0x10          //Move cursor left without changing display data RAM
#define _LCD_MOVE_CURSOR_RIGHT  0x14           //Move cursor right without changing display data RAM
#define _LCD_TURN_ON            0x0C         //Turn Lcd display on
#define _LCD_TURN_OFF           0x08         //Turn Lcd display off
#define _LCD_SHIFT_LEFT         0x18         //Shift display left without changing display data RAM
#define _LCD_SHIFT_RIGHT        0x1E         //Shift display right without changing display data RAM
 
sbit One_Wire at GP0_bit;
sbit One_Wire_Direction at TRISIO0_bit;
 
//Function Prototypes
/*
void One_Wire_LCD_Init();
void One_Wire_LCD_Cmd(char out_char);
void One_Wire_LCD_Chr(char row, char col, char out_char);
void One_Wire_LCD_Chr_Cp(char out_char);
void One_Wire_LCD_Out(char row, char col, char *str);
void One_Wire_LCD_Out_Cp(char *str);
void WriteNibbles(char nib, char rs);
*/
 
unsigned char msg1[] = "One-Wire LCD";
unsigned char msg2[] = "4 bit";
unsigned char msg3[] = "20x4";
unsigned char msg4[] = "HD44780";
 
void Delay_6ms() {
    Delay_ms(6);
}
 
void Delay_15us() {
    Delay_us(11);
}
 
void Send_Byte(char out_char, char rs) {
    char i = 0, mask = 0x80;
    
    out_char.F2 = rs;        
    
    for(i = 0; i < 7; i++) {    // send all 7 bits
        if(out_char & mask) {   // if HI bit, make 1uS low pulse
             One_Wire = 0;  // make LO pulse
             One_Wire = 1;      // end LO pulse
             Delay_15uS();      // safe 15uS pulse recovery
        }
        else {          // else is LO bit!
             One_Wire = 0;          
             Delay_15uS();      // 15uS LO pulse
             One_Wire = 1;          
             Delay_15uS();  // 30uS recovery
             Delay_15uS();  
        }
        // now we have sent that bit out using Shift1 timed protocol!
        mask >>= 1;             // get the next bit
               
    }
    
    // The Shift1 protocol requires that the 8th bit is very
    // long, this causes the 74HC595 shift register to latch
    // all the 8 bits to its output port.
    // NOTE! the 8th bit (bit0) will always be received as zero.
    One_Wire = 0;   // send 8th bit, lo pulse = 14x15 = 210uS           
    for(i = 14; i; i--)Delay_15uS();  
    One_Wire = 1;   // and hi recovery 20x15 = 300 uS       
    for(i = 20; i; i--)Delay_15uS();   
}
 
void WriteNibbles(char out_char, char rs) {
     char dummy;
     
     dummy = out_char & 0xF0;
     
     dummy.F3 = 1;
     Send_Byte(dummy, rs);
     dummy.F3 = 0;
     Send_Byte(dummy, rs);
     
     dummy = out_char & 0x0F;
     dummy <<= 4;
     dummy.F3 = 1;
     Send_Byte(dummy, rs);
     dummy.F3 = 0;
     Send_Byte(dummy, rs);
}
 
void One_Wire_LCD_Cmd(char out_char) {
    char rs = 0;
    
    WriteNibbles(out_char, rs);
    Delay_ms(5);
}
 
void One_Wire_LCD_Chr(char row, char col, char out_char) {
    char rs = 1;
    
    switch(row){    
            case 1:
                One_Wire_LCD_Cmd(0x80 + col-1);
                break;
            case 2:
                One_Wire_LCD_Cmd(0xC0 + col-1);
                break;
            case 3:
                One_Wire_LCD_Cmd(0x94 + col-1);
                break;
            case 4:
                One_Wire_LCD_Cmd(0xD4 + col-1);
                break;
    }   
                             
    WriteNibbles(out_char, rs);    
}
 
void One_Wire_LCD_Chr_Cp(char out_char) {    
    char rs = 1;
                             
    WriteNibbles(out_char, rs);    
}
 
void One_Wire_LCD_Out(char row, char col, char *str) {        
    while(*str)
        One_Wire_LCD_Chr(row,col++,*str++);       
}
 
void One_Wire_LCD_Out_Cp(char *str) {        
    while(*str)
        One_Wire_LCD_Chr_Cp(*str++);       
}
 
void One_Wire_LCD_Init() {
    Delay_ms(150);
    One_Wire_LCD_Cmd(0x30);
    Delay_ms(30);
    One_Wire_LCD_Cmd(0x30);
    Delay_ms(30);
    One_Wire_LCD_Cmd(0x30);
    Delay_ms(30);
    One_Wire_LCD_Cmd(0x20);
    Delay_ms(20);
    One_Wire_LCD_Cmd(0x28);   
    Delay_ms(10);
    One_Wire_LCD_Cmd(0x06);  
    Delay_ms(10);    
}
 
void main() {
 
     ANSEL = 0x00;
     
     TRISIO = 0x00;
     GPIO = 0x00;
 
     One_Wire_LCD_Init();
     One_Wire_LCD_Cmd(_LCD_CLEAR);
     One_Wire_LCD_Cmd(_LCD_CURSOR_OFF);
 
     One_Wire_LCD_Out(1,1,"One-Wire");
     One_Wire_LCD_Out(2,1,"Serial LCD");
     One_Wire_LCD_Out(3,1,"20X4");
     One_Wire_LCD_Out(4,1,"Using 74HC595");
     
     while(1){
          ;
     }
}




Made this change is Send_Byte()

Code:
out_char.F1 = rs;

Changed the circuit a little.

New Circuit. dummy.F1 is RS and dummy.F3 is EN
 

Attachments

  • owlcd.png
    owlcd.png
    29.3 KB · Views: 7
Last edited:

zuisti

Advanced Member level 1
Joined
Jul 2, 2004
Messages
480
Helped
188
Reputation
376
Reaction score
184
Trophy points
1,323
Location
Hungary
Activity points
3,313
Hi Milan;

Do you know my mikroC LCD libraries on LibStock?
https://www.libstock.com/projects/view/959/full-lcd-library-set

They are closed libraries, I know, but all work as well.
As you see, my one-wire solution is also based on the Roman Black's circuit, but I used a lot asm code also.

For your PIC12F683 use the p16_... libraries, in this case the p16_w1Lcd-4.mcl.
zuisti (Istvan K)
 

milan.rajik

Banned
Joined
Apr 1, 2013
Messages
2,528
Helped
540
Reputation
1,078
Reaction score
524
Trophy points
1,393
Activity points
0
Ok zuisti. I will try your library.

I made changes to LCD_Init() function.


Code C - [expand]
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
#define _LCD_FIRST_ROW          0x80         //Move cursor to the 1st row
#define _LCD_SECOND_ROW         0xC0         //Move cursor to the 2nd row
#define _LCD_THIRD_ROW          0x94         //Move cursor to the 3rd row
#define _LCD_FOURTH_ROW         0xD4         //Move cursor to the 4th row
#define _LCD_CLEAR              0x01         //Clear display
#define _LCD_RETURN_HOME        0x02         //Return cursor to home position, returns a shifted display to
                                                 //its original position. Display data RAM is unaffected.
#define _LCD_CURSOR_OFF         0x0C         //Turn off cursor
#define _LCD_UNDERLINE_ON       0x0E         //Underline cursor on
#define _LCD_BLINK_CURSOR_ON    0x0F          //Blink cursor on
#define _LCD_MOVE_CURSOR_LEFT   0x10          //Move cursor left without changing display data RAM
#define _LCD_MOVE_CURSOR_RIGHT  0x14           //Move cursor right without changing display data RAM
#define _LCD_TURN_ON            0x0C         //Turn Lcd display on
#define _LCD_TURN_OFF           0x08         //Turn Lcd display off
#define _LCD_SHIFT_LEFT         0x18         //Shift display left without changing display data RAM
#define _LCD_SHIFT_RIGHT        0x1E         //Shift display right without changing display data RAM
 
sbit One_Wire at GP0_bit;
sbit One_Wire_Direction at TRISIO0_bit;
 
//Function Prototypes
/*
void One_Wire_LCD_Init();
void One_Wire_LCD_Cmd(char out_char);
void One_Wire_LCD_Chr(char row, char col, char out_char);
void One_Wire_LCD_Chr_Cp(char out_char);
void One_Wire_LCD_Out(char row, char col, char *str);
void One_Wire_LCD_Out_Cp(char *str);
void WriteNibbles(char nib, char rs);
*/
 
unsigned char msg1[] = "One-Wire LCD";
unsigned char msg2[] = "4 bit";
unsigned char msg3[] = "20x4";
unsigned char msg4[] = "HD44780";
 
void Delay_6ms() {
    Delay_ms(6);
}
 
void Delay_15us() {
    Delay_us(11);
}
 
void Send_Byte(char out_char, char rs) {
    char i = 0, mask = 0x80;
    
    out_char.F1 = rs;            
    
    for(i = 0; i < 7; i++) {    // send all 7 bits
        if(out_char & mask) {   // if HI bit, make 1uS low pulse
             One_Wire = 0;  // make LO pulse
             One_Wire = 1;      // end LO pulse
             Delay_15uS();      // safe 15uS pulse recovery
        }
        else {          // else is LO bit!
             One_Wire = 0;          
             Delay_15uS();      // 15uS LO pulse
             One_Wire = 1;          
             Delay_15uS();  // 30uS recovery
             Delay_15uS();  
        }
        // now we have sent that bit out using Shift1 timed protocol!
        mask >>= 1;             // get the next bit
               
    }
    
    // The Shift1 protocol requires that the 8th bit is very
    // long, this causes the 74HC595 shift register to latch
    // all the 8 bits to its output port.
    // NOTE! the 8th bit (bit0) will always be received as zero.
    One_Wire = 0;   // send 8th bit, lo pulse = 14x15 = 210uS           
    for(i = 14; i; i--)Delay_15uS();  
    One_Wire = 1;   // and hi recovery 20x15 = 300 uS       
    for(i = 20; i; i--)Delay_15uS();   
}
 
void WriteNibbles(char out_char, char rs) {
     char dummy;
     
     dummy = out_char & 0xF0;
     
     dummy.F3 = 1;
     Send_Byte(dummy, rs);
     dummy.F3 = 0;
     Send_Byte(dummy, rs);
     
     dummy = out_char & 0x0F;
     dummy <<= 4;
     dummy.F3 = 1;
     Send_Byte(dummy, rs);
     dummy.F3 = 0;
     Send_Byte(dummy, rs);
}
 
void Write_High_Nibble(char out_char) {
     char dummy, rs = 0;
     
     dummy = out_char & 0xF0;
     
     dummy.F3 = 1;
     Send_Byte(dummy, rs);
     dummy.F3 = 0;
     Send_Byte(dummy, rs);    
}
 
void One_Wire_LCD_Cmd(char out_char) {
    char rs = 0;
    
    WriteNibbles(out_char, rs);
    Delay_ms(5);
}
 
void One_Wire_LCD_Chr(char row, char col, char out_char) {
    char rs = 1;
    
    switch(row){    
            case 1:
                One_Wire_LCD_Cmd(0x80 + col-1);
                break;
            case 2:
                One_Wire_LCD_Cmd(0xC0 + col-1);
                break;
            case 3:
                One_Wire_LCD_Cmd(0x94 + col-1);
                break;
            case 4:
                One_Wire_LCD_Cmd(0xD4 + col-1);
                break;
    }   
                             
    WriteNibbles(out_char, rs);    
}
 
void One_Wire_LCD_Chr_Cp(char out_char) {    
    char rs = 1;
                             
    WriteNibbles(out_char, rs);    
}
 
void One_Wire_LCD_Out(char row, char col, char *str) {        
    while(*str)
        One_Wire_LCD_Chr(row,col++,*str++);       
}
 
void One_Wire_LCD_Out_Cp(char *str) {        
    while(*str)
        One_Wire_LCD_Chr_Cp(*str++);       
}
 
void One_Wire_LCD_Init() {
    Delay_ms(150);
    Write_High_Nibble(0x30);
    Delay_ms(30);
    Write_High_Nibble(0x30);
    Delay_ms(30);
    Write_High_Nibble(0x30);
    Delay_ms(30);
    Write_High_Nibble(0x20);
    Delay_ms(20);
    One_Wire_LCD_Cmd(0x28);   
    Delay_ms(10);
    One_Wire_LCD_Cmd(0x06);  
    Delay_ms(10);    
}
 
void main() {
 
     ANSEL = 0x00;
     
     TRISIO = 0x00;
     GPIO = 0x00;
 
     One_Wire = 1;
     
     One_Wire_LCD_Init();
     One_Wire_LCD_Cmd(_LCD_CLEAR);
     One_Wire_LCD_Cmd(_LCD_CURSOR_OFF);
 
     One_Wire_LCD_Out(1,1,"One-Wire");
     One_Wire_LCD_Out(2,1,"Serial LCD");
     One_Wire_LCD_Out(3,1,"20X4");
     One_Wire_LCD_Out(4,1,"Using 74HC595");
     
     while(1){
          ;
     }
}



- - - Updated - - -

It worked. I made small changes in code. The changes made are in Send_Byte() function. The delays were not proper. Changed the Delay functions. Main problem was REALCAP model of Proteus. REALCAP model is not actually a REAL CAPACITOR model. I replaced the model with 2n2 Capacitor model and the project worked beautifully.

In hardware it is still not working. I have used 1% tolerance Metal Film Restsitors. My capacitors are not good and they are low tolerance ordinary ceramic ones. I will replace the resistors with 0.01% tolerance resistors and capacitors with high grade multilayer ceramic capacitors and see what happens.

118716d1434973492-one-wire-lcd-working.png


- - - Updated - - -

It worked in hardware. In code dummy.F1 is RS and dummy.F3 is EN but in hardware according to old circuit Q2 was RS. I changed it to Q1 and it worked.
 

Attachments

  • one wire lcd working.png
    one wire lcd working.png
    32.6 KB · Views: 33
  • One Wire LCD rev2.rar
    63.1 KB · Views: 6

milan.rajik

Banned
Joined
Apr 1, 2013
Messages
2,528
Helped
540
Reputation
1,078
Reaction score
524
Trophy points
1,393
Activity points
0
Why this One-Wire 40x4 4bit LCD not working properly. I am testing in Proteus and also hardware. In both first line doesn't print properly and 2nd line doesn't print. Line 3 and 4 is ok.

118742d1435019056-40x4-ow-lcd.png
 

Attachments

  • 40x4 One Wire LCD.rar
    126 KB · Views: 7
  • 40x4 ow lcd.png
    40x4 ow lcd.png
    74.8 KB · Views: 26

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Top