Jump to content

thedarkshade

Senior Members
  • Posts

    1421
  • Joined

  • Last visited

About thedarkshade

  • Birthday April 22

Profile Information

  • Location
    Republic of Kosova
  • Interests
    Everything but skiing and detailed chemistry!
  • College Major/Degree
    yet expecting...
  • Favorite Area of Science
    Physics & Mathematics
  • Biography
    Curious and stubborn!
  • Occupation
    Student

Retained

  • Organism

thedarkshade's Achievements

Organism

Organism (8/13)

76

Reputation

  1. Hi everyone I've had this project on controlling the light intensity with a microcontroller, using phase control. I've build the zero-cross detector and the circuitry to interface with the light via an optocoupler (MOC3023) and a triac (BT138), but I'm a little stuck on the software. I'm using an on-board potentiometer to control the intensity and a 12bit ADC to get the digital value, but I think I can easily complete by having an 8bit value. So my point of concern is how do I change this 12bit value into an 8bit one? Any help at all would be greatly appreciated TDS
  2. 1. I believe that fundamentally it has to do with the natural tendency of physical systems to reach 'a lower energy state', that is a more stable one. Disorder is just the word we seem to use to describe it when we see no elegance while the process is under way. 3. Reality is not ideal I guess
  3. Oh, and btw is there something like "8051 LCD command list" like the 'enter command' or 'backspace'? The ones I have above (move_left, move_right, del,...) I collected from several books I happen to have on microcontrollers, but I feel my project's lacking a taste of completeness.
  4. No no, I'm using pushbuttons on the board as keys. I got it to work lasht night actually. I seem to have been carrying a bit from the ISR routine that was causing me trouble. P.s. I apologize for lack of comments (not a good programmer). Some of the labels too are in my native language
  5. Hey everyone. I've been working for quite a while on this one. I've been trying to make a VT100 terminal emulator through serial port (RS232 standard) using Easy8051A development board. I've written down the entire code for writing from hyperterminial (yeah, I nedded XP for that) to a 2x16 LCD (8-bit mode) and also for writing from the board to hyperterminal, but I got stuck trying to bring the two together. I know I must somehow use serial interrupts to check whether a key has been pressed or not but I can't just quite figure it out. I'll post the code down here, just in case anyone has any bit of idea of how could I proceed. This is the code to write to the LCD (control codes including): ESC EQU 1BH ORG 0000H LJMP MAIN ORG 0023H MAIN: BUSY BIT P0.7 E BIT P2.4 RS BIT P2.2 RW BIT P2.3 MOV A, PCON SETB ACC.7 MOV PCON, A MOV SCON, #52h MOV TMOD, #20h MOV TH1, #-35 SETB EA SETB ES SETB PS SETB TR1 CALL LCD_INIT; PRANO: JNB RI, $ ; KONTROLLO A ESHTE SHRYPUR NDOJE KARAKTER CLR RI MOV A, SBUF CHECK_DEL: CJNE A, #7FH, CONTINUE LJMP CLEAR_LCD LJMP NEXT CONTINUE: CJNE A, #ESC, NO_ESC1 CLR P1.7 JNB RI, $ CLR RI MOV A, SBUF CJNE A, #'[', NO_KLLAPA JNB RI, $ CLR RI MOV A, SBUF CJNE A, #'C', CHECK_D LCALL MOVE_LEFT LJMP NEXT CHECK_D: CJNE A, #'D', CHECK_A LCALL MOVE_RIGHT LJMP NEXT CHECK_A: CJNE A, #'A', CHECK_B LCALL MOVE_UP LJMP NEXT CHECK_B: CJNE A, #'B', NEXT LCALL MOVE_DOWN LJMP NEXT NO_ESC1: LJMP NO_ESC MOVE_LEFT: MOV A, #14H ACALL COMMAND RET MOVE_RIGHT: MOV A, #10H ACALL COMMAND RET MOVE_UP: LCALL READY MOV A, P0 ANL A,#00111111B MOV R7, A MOV A, #40H SUBB A, R6 MOV R6, A MOV A, R7 SETB ACC.7 ACALL COMMAND RET MOVE_DOWN: LCALL READY MOV A, P0 ANL A, #00111111B MOV R6, A MOV A, #40H ADD A, R6 MOV R7, A MOV A, R7 SETB ACC.7 ACALL COMMAND RET CLEAR_LCD: MOV A, #01H CALL COMMAND NO_KLLAPA: LJMP NEXT ;****************************************************************** LCD_INIT: ;* MOV A, #38H ; 2 Linja 5x7 ;* ACALL COMMAND ;* MOV A, #0DH ;Aktivizimi i Kursorit (Blinkues) ;* ACALL COMMAND ;* MOV A, #01H ;Fshirja e ekranit ;* ACALL COMMAND ;* MOV A, #06H ;Vendosja e Kursorit Ne Te Djathe ;* ACALL COMMAND ;* RET ;* ;* \ ;*=================\ COMMAND: ;*==================\ ACALL READY ;*==================/ Pergaditja e LCD-se MOV P0, A ;*=================/ CLR RS ;* / CLR RW ;* SETB E ;* CLR E ;* RET ;* ;* ;* ;* READY: ;* SETB BUSY ;* MOV P0, #0FFH ;* CLR RS ;* SETB RW ;* BACK: ;* CLR E ;* SETB E ;* JB BUSY, BACK ;* RET ;* ;* ;****************************************************************** NO_ESC: LCALL LCD_DISPLAY CPL A MOV P1,A NEXT: SETB P1.7 LJMP PRANO LCD_DISPLAY: ACALL READY CLR E MOV P0, A SETB RS CLR RW SETB E CLR E RET STOP: END This is the code for hyperterminal-to-board: ORG 0000H MOV A, PCON ;| SETB ACC.7 ;|------->Mundesimi i Dyfishimit te Baud-Rate (SMOD=1) MOV PCON, A ;| ;----------------| MOV SCON, #52H ;Pori Serik, Modi 1 MOV TMOD, #20H ;Timeri-i 1, Modi 2 MOV TH1, #-35 ; 1200 baud-rate SETB TR1 ; Starton timer-in 1 WRITE_TO_TERMINAL: JB P0.0, CHECK_B WRITE_A: MOV A, #41H CALL OUTCHR CHECK_B:JB P0.1, CHECK_C WRITE_B: MOV A, #42H CALL OUTCHR CHECK_C:JB P0.2, CHECK_D WRITE_C: MOV A, #43H CALL OUTCHR CHECK_D:JB P0.3, CHECK_E WRITE_D: MOV A, #44H CALL OUTCHR CHECK_E: JB P0.4, CHECK_F WRITE_E: MOV A, #45H CALL OUTCHR CHECK_F:JB P0.5, CHECK_G WRITE_F: MOV A, #46H CALL OUTCHR CHECK_G:JB P0.6, CHECK_H WRITE_G: MOV A, #47H CALL OUTCHR CHECK_H:JB P0.7, CHECK_I WRITE_H: MOV A, #48H CALL OUTCHR CHECK_I:JB P1.0, CHECK_J WRITE_I: MOV A, #49H CALL OUTCHR CHECK_J: JB P1.1, CHECK_K WRITE_J: MOV A, #04AH CALL OUTCHR CHECK_K: JB P1.2, CHECK_L WRITE_K: MOV A, #04BH CALL OUTCHR CHECK_L: JB P1.3, CHECK_M WRITE_L: MOV A, #04CH CALL OUTCHR CHECK_M: JB P1.4, CHECK_N WRITE_M: MOV A, #04DH CALL OUTCHR CHECK_N: JB P1.5, CHECK_O WRITE_N: MOV A, #04EH CALL OUTCHR CHECK_O: JB P1.6, CHECK_P WRITE_O: MOV A, #04FH CALL OUTCHR CHECK_P: JB P1.7, CHECK_Q WRITE_P: MOV A, #50H CALL OUTCHR CHECK_Q: JB P2.0, CHECK_R WRITE_Q: MOV A, #51H CALL OUTCHR CHECK_R: JB P2.1, CHECK_S WRITE_R: MOV A, #52H CALL OUTCHR CHECK_S: JB P2.2, CHECK_T WRITE_S: MOV A, #53H CALL OUTCHR CHECK_T: JB P2.3, CHECK_U WRITE_T: MOV A, #54H CALL OUTCHR CHECK_U: JB P2.4, CHECK_V WRITE_U: MOV A, #55H CALL OUTCHR CHECK_V: JB P2.5, CHECK_W WRITE_V: MOV A, #56H CALL OUTCHR CHECK_W: JB P2.6, CHECK_X WRITE_W: MOV A, #57H CALL OUTCHR CHECK_X: JB P2.7, CHECK_Y WRITE_X: MOV A, #58H CALL OUTCHR CHECK_Y: JB P3.2, CHECK_Z WRITE_Y: MOV A, #59H CALL OUTCHR CHECK_Z: JB P3.3, CHECK_SPACE WRITE_Z: MOV A, #05AH CALL OUTCHR CHECK_SPACE: JB P3.4, CHECK_AGAIN WRITE_SPACE: MOV A, #' ' CALL OUTCHR CHECK_AGAIN: LCALL WRITE_TO_TERMINAL OUTCHR: JNB TI, OUTCHR CLR TI CALL VONESA MOV SBUF, A CALL WRITE_TO_TERMINAL VONESA: MOV R6, #0FFH MOV R7, #05FH PERS: MOV R5, #0FFH DJNZ R5, $ DJNZ R7, $ DJNZ R6, PERS RET STOP: END and this is how I've tried to bring the two together (unsuccessfully): ESC EQU 1BH ORG 0000H LJMP MAIN ORG 0023H LJMP ISR ORG 0030H MAIN: BUSY BIT P0.7 E BIT P2.4 RS BIT P2.2 RW BIT P2.3 MOV A, PCON SETB ACC.7 MOV PCON, A MOV SCON, #52h MOV TMOD, #20h MOV TH1, #-35 SETB EA SETB ES SETB PS SETB TR1 CALL LCD_INIT; PRANO: JNB RI, $ ; KONTROLLO A ESHTE SHRYPUR NDOJE KARAKTER CLR RI JNB P1.0, GO_INT_I JNB P1.1, GO_INT_J JNB P1.2, GO_INT_K JNB P1.3, GO_INT_L JNB P1.4, GO_INT_M JNB P1.5, GO_INT_N JNB P1.6, GO_INT_O JNB P1.7, GO_INT_P MOV A, SBUF JMP CHECK_DEL GO_INT_I: CLR P1.0 MOV IE, #90H JMP PRANO GO_INT_J: CLR P1.1 MOV IE, #90H JMP PRANO GO_INT_K: CLR P1.2 MOV IE, #90H JMP PRANO GO_INT_L: CLR P1.3 MOV IE, #90H JMP PRANO GO_INT_M: CLR P1.4 MOV IE, #90H JMP PRANO GO_INT_N: CLR P1.5 MOV IE, #90H JMP PRANO GO_INT_O: CLR P1.6 MOV IE, #90H JMP PRANO GO_INT_P: CLR P1.7 MOV IE, #90H JMP PRANO CHECK_DEL: CJNE A, #7FH, CONTINUE LJMP CLEAR_LCD LJMP NEXT CONTINUE: CJNE A, #ESC, NO_ESC1 CLR P1.7 JNB RI, $ CLR RI MOV A, SBUF CJNE A, #'[', NO_KLLAPA JNB RI, $ CLR RI MOV A, SBUF CJNE A, #'C', CHECK_D LCALL MOVE_LEFT LJMP NEXT CHECK_D: CJNE A, #'D', CHECK_A LCALL MOVE_RIGHT LJMP NEXT CHECK_A: CJNE A, #'A', CHECK_B LCALL MOVE_UP LJMP NEXT CHECK_B: CJNE A, #'B', NEXT LCALL MOVE_DOWN LJMP NEXT NO_ESC1: LJMP NO_ESC MOVE_LEFT: MOV A, #14H ACALL COMMAND RET MOVE_RIGHT: MOV A, #10H ACALL COMMAND RET MOVE_UP: LCALL READY MOV A, P0 ANL A,#00111111B MOV R7, A MOV A, #40H SUBB A, R6 MOV R6, A MOV A, R7 SETB ACC.7 ACALL COMMAND RET MOVE_DOWN: LCALL READY MOV A, P0 ANL A, #00111111B MOV R6, A MOV A, #40H ADD A, R6 MOV R7, A MOV A, R7 SETB ACC.7 ACALL COMMAND RET CLEAR_LCD: MOV A, #01H CALL COMMAND NO_KLLAPA: LJMP NEXT ;****************************************************************** LCD_INIT: ;* MOV A, #38H ; 2 Linja 5x7 ;* ACALL COMMAND ;* MOV A, #0DH ;Aktivizimi i Kursorit (Blinkues) ;* ACALL COMMAND ;* MOV A, #01H ;Fshirja e ekranit ;* ACALL COMMAND ;* MOV A, #06H ;Vendosja e Kursorit Ne Te Djathe ;* ACALL COMMAND ;* RET ;* ;* \ ;*=================\ COMMAND: ;*==================\ ACALL READY ;*==================/ Pergaditja e LCD-se MOV P0, A ;*=================/ CLR RS ;* / CLR RW ;* SETB E ;* CLR E ;* RET ;* ;* ;* ;* READY: ;* SETB BUSY ;* MOV P0, #0FFH ;* CLR RS ;* SETB RW ;* BACK: ;* CLR E ;* SETB E ;* JB BUSY, BACK ;* RET ;* ;* ;****************************************************************** NO_ESC: LCALL LCD_DISPLAY CPL A MOV P1,A NEXT: MOV P1, #0FFH LJMP PRANO LCD_DISPLAY: ACALL READY CLR E MOV P0, A SETB RS CLR RW SETB E CLR E RET ISR: WRITE_TO_TERMINAL: CHECK_I:JB P1.0, CHECK_J WRITE_I: MOV A, #49H CALL OUTCHR CHECK_J: JB P1.1, CHECK_K WRITE_J: MOV A, #04AH CALL OUTCHR CHECK_K: JB P1.2, CHECK_L WRITE_K: MOV A, #04BH CALL OUTCHR CHECK_L: JB P1.3, CHECK_M WRITE_L: MOV A, #04CH CALL OUTCHR CHECK_M: JB P1.4, CHECK_N WRITE_M: MOV A, #04DH CALL OUTCHR CHECK_N: JB P1.5, CHECK_O WRITE_N: MOV A, #04EH CALL OUTCHR CHECK_O: JB P1.6, CHECK_P WRITE_O: MOV A, #04FH CALL OUTCHR CHECK_P: JB P1.7, CHECK_AGAIN WRITE_P: MOV A, #50H CALL CHECK_AGAIN CHECK_AGAIN: RETI OUTCHR: JNB TI, OUTCHR CLR TI CALL VONESA MOV SBUF, A CLR EA RETI VONESA: MOV R6, #0FFH MOV R7, #05FH PERS: MOV R5, #0FFH DJNZ R5, $ DJNZ R7, $ DJNZ R6, PERS RET END I know it's exceedingly boring to go through it all (neither I expext you to) but I'd really appreciate every idea on how to bring the two together. Regards, TDS
  6. Hello! We have created a science forum. Researchers, professors, post graduate students and undergraduate students are invited to join/register our forum.

    http://science.forumakers.com/

    This is the link to my forum. It is still under construction and will be fully active from 1is august. Last date of registration is 15th august, so please join it as soon as possible. It will be a great pleasure for me, if you join it.

     

    Nikhil aggarwal

    University of Delhi, India

    vedmecum@gmail.com

  7. I believe that's it:-) Good work Sisyphus
  8. Could you explain how you got your answer (I don't know if its correct)? Here's how I got my 41.5 days The cow can finish it alone in 90 days. Since it take the goat twice as more time to finish when it is with the duck, compared to the cow, then (I assume) it would take the duck 180 days to finish to finish the entire thing alone. And similarly I got 135 days for the goat (though I'm not so sure on this one). And if you try to get the number of days that would take for the three of them together, then I tried x/90 + x/180 + x/135 = 1 than I got that x=41.5.... But there's another way to look this. If the cow finishes alone in 90 days, then if would finish half in 45 days. And since it takes the duck and the goat 90 days to finish it together, the three of them would finish it in 45 days:( But the problem (I think) is that none of these takes into consideration the new grass growing:-(
  9. OMFG, sorry! The question is "How many days does it take the three of them together to eat all the grass."
  10. Hey people, how are you doing? I heard this couple days ago and tried to figure it out myself but I seem not to be able to:( It goes like this: |=|A cow and a goat eat all the grass of a pasture in 45 days. The (same) cow and a duck eat the grass in 60 days, and the duck and the goat east the grass in 90 days. The cow eats the same amount of grass as the duck and the goat together. But you have to take into consideration that new grass grows continuously.|=| At first I got 45 days, then I got 41.5... days but I think neither of them is the answer. Any suggestion?
  11. I've had the same idea too, but so far I haven't come across any H-R diagram that would show the relation mass-radius. Merged post follows: Consecutive posts merged Thank you for this. I just downloaded it, and I'm going to read it right now.
  12. Hey guys, I was discussing with a friend about the evolution of stars, our sun especially. It's now absolutely well known that the radius of a star when it turns into a red giant is increased a lot, but he asked me whether there is a formula or any other way using which you can calculate this radius increase yourself. Of course there must be some way, and I couldn't answer him. So is there a formula, or other way so you can calculate yourself what the radius of our sun (for example) will increase when it turns into a Red Giant? Regards, shade
  13. Merry Christmas to you all. (Next stop: New Year)
  14. Thanks for accepting YT:-)

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.