Hi.
Thanks for answers.
So I pulled 'Output enable' high, and changed 'check bit' to right shift.
I've also double checked my hardware and everything seems to be fine there.
I've got CL on GP0, DT on GP1 and ST on GP2. Do I need anything else in terms of hardware?
I made few tests and I believe it is a software problem, here's why:
everytime I feed my function with byte starting with "1" (for example 0b11001100) displayed result is OK
everytime I use byte starting with "0" (for example 0b00110011) there is some random result, sometimes diff. after power off/on.
I run umpty tests and it was always like this, whenever my byte starts with 0b1.... it's ok, whenever my byte starts with 0b0... it's wrong.
I made few photos
here (when you click on the image, check the file name in the address bar - it's the bit pattern used)
Any clue what's going on?
I'm not using larger µC because it doesn't have any real purpose, I'm just learning.
Here's my complete program i was using for testing:
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
| // 4094.h------------------------------------
#ifndef __4094_h__
#define __4094_h__
__CONFIG(OSC_IntRC & WDT_OFF & MCLRE_OFF & CP_OFF);
#define CL GP0
#define DT GP1
#define ST GP2
//#define EN GP5
void set4094(unsigned char c)
{
for(unsigned char i = 0; i < 8; i++)
{
DT =((c>>i) & 1);
CL = 1;
CL = 0;
}
ST = 1;
ST = 0;
}
#endif
//4094.h end---------------------------------
//main.c ------------------------------------
#include<htc.h>
#include"4094.h"
void main()
{
TRIS = 0;
set4094(0b10001000);
while(1)
{
}
}
//main.c end--------------------------------- |