PIC12F683 UART_Soft problems

Status
Not open for further replies.

imranahmed

Advanced Member level 3
Joined
Dec 4, 2011
Messages
822
Helped
3
Reputation
6
Reaction score
3
Trophy points
1,298
Location
Karachi,Pakistan
Visit site
Activity points
6,533
Please anyone clear my some confusions about attached code.
In the code,Soft_UART_Write(10); // Line Feed
Soft_UART_Write(13); // Carriage Return
what is the purpose of these commands.
 

Attachments

  • UART.txt
    878 bytes · Views: 130
Last edited:

These commands send data through UART (Software UART).
10 is the ASCII code for "Line Feed".
13 is the ASCII code for "Carriage Return".

The above 2 lines basically instruct to go the beginning of a new line.
 
Maybe the transistor you have used in Proteus doesn't have a spice model. Try using 2N3095 because you are using Common Anode type 7 Segment display.
See the image.
 

Attachments

  • CA 7 Segment.jpg
    108.3 KB · Views: 114
Last edited:

Please check attached circuit,this is not working, what should I do?

Use a base resistor for the transistor. You can see my simulation result below. Use this circuit.



Note: In practice, you don't need R3. I used it for simulation purpose.

Hope this helps.
Tahmid.
 
Please let me know about the 7-segment display (SEC2414NK 11A, SENIOR).
I cannot find its datasheet on internet.
In direct connections,the above mention 7-segment display on at 7.5Volts @ 25mA but microcontroller output have 5Volts @ 2mA.
Would i use transistors?
I make a digital clock but 7-segment display cannot display.
I will attached simulation.

- - - Updated - - -

I used common cathode.
 

Most 7 segment displays will work easily at 5V. If your display does not work with 5V, but requires a minimum of 7.5V, then you can use 7.5V supply. But you'll need a level shifter circuit to convert the microcontroller output voltage up to 7.5V. You can use transistors for that.
 
Attached please check it.
Problem in the connections of 7-segment display it is 7.5V and transistor conncetions.
 

Attachments

  • dc.bmp
    2.3 MB · Views: 82
  • Photo0200.jpg
    24.6 KB · Views: 87

Ground the emitters of the transistors. Connect resistors between the microcontroller outputs and transistor bases. Connect resistor to limit current to D1 and D2.

Remember to use current limiting resistors between the microcontroller outputs and the 7 segment connections if required by the 7 segment display.

This is for 5V. For 7.5V, you'll need to make some changes since in this case the 7 segments are driven with 5V.

Hope this helps.
Tahmid.
 
You can test them and can quickly find out their connections. The center pins on either side are the common pins (common cathode or common anode). Connect the common pins to +5V or ground depending on whether they are common anode or common cathode. Then use a resistor and connect +5V or ground (depending on common cathode or common anode) to all the other pins and see which segments light up.

Hope this helps.
Tahmid.
 

I found their pins successfully and connection are built properly but displays are operate at 7.5V not at 5V what nscan i do to increase voltage 5v to 7.5v.If I use transistors at all A-G pins they will successfully operate or not?
 

Please let me know what is the meaning of this command below.

" if((GPIO & 0x33) != 0x33)" // wait for switch to go low
 

Please let me know what is the meaning of this command below.

" if((GPIO & 0x33) != 0x33)" // wait for switch to go low

The first part of the if statement expression,

Code:
([COLOR="#FF0000"]GPIO & 0x33[/COLOR]) != 0x33

Masks the value of GPIO to the value of 0x33.

The bitwise AND operator (&) masks all the bits of first operand (GPIO) with the value of the second operand (0x33 or 0b00110011).

The operation essentially clears all corresponding bits which are not set and leaves any corresponding bits set unchanged.

Therefore bits 0, 1, 4 and 5 of the value in GPIO are left unchanged while all other bits are cleared.

The second part of if statement expression,

Code:
(GPIO & 0x33) [COLOR="#FF0000"]!= 0x33[/COLOR]

Simply tests whether the results of the mask operation are not equal to the value 0x33.


Essentially if any of the bits 0, 1, 4, or 5 are clear the expression is true, if they are all set then the expression is false as the resulting is indeed 0x33.

Perhaps there are switches attached to the lines, GPIO0, GPIO1, GPIO4 and GPIO5, these lines are normally held high, however when a switch is closed the corresponding line goes low which causes the if statement expression to become true, the contents of which handle the switch closure.



Mask (computing)

Bit Operations


BigDog
 
Status
Not open for further replies.

Similar threads

Cookies are required to use this site. You must accept them to continue using the site. Learn more…