home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #18 / NN_1992_18.iso / spool / sci / electron / 14336 < prev    next >
Encoding:
Text File  |  1992-08-13  |  2.0 KB  |  70 lines

  1. Newsgroups: sci.electronics
  2. Path: sparky!uunet!caen!uwm.edu!csd4.csd.uwm.edu!pegasus
  3. From: pegasus@csd4.csd.uwm.edu (David R Hucke)
  4. Subject: DS5000 question
  5. Message-ID: <1992Aug14.013841.20246@uwm.edu>
  6. Originator: pegasus@csd4.csd.uwm.edu
  7. Sender: news@uwm.edu (USENET News System)
  8. Organization: Computing Services Division, University of Wisconsin - Milwaukee
  9. Date: Fri, 14 Aug 1992 01:38:41 GMT
  10. Lines: 58
  11.  
  12. Hi everyone:
  13.  
  14. Got a question or two about an 8051 problem (DS5000 actually).
  15.  
  16. I have an LED hooked up to P0.0 through a PNP transistor buffer.  This
  17. part is fine.  I have a a resistor (330 Ohms) hooked up to P0.1 which can
  18. be set to ground of +5v.  
  19.  
  20. Below is my program,  it should do the following,  
  21.  
  22.     1)  Turn of the watchdog timer  (disable it).
  23.     2)  Enable P0.1 as an INPUT by writing a 1 to it.
  24.     3)  Turn off the LED at P0.0
  25.     4)  When P0.1 goes high, the LED should light up.
  26.     5)  When P0.1 goes low, the LED should turn off.
  27.  
  28. This is not what is happening.  What is happening is that the LED never
  29. turns completely off and the LED sometimes lights up when I put P0.1 to
  30. ground.  After about approx 5-10 seconds,  I have to reset the DS5000 to
  31. get any results at all.  And sometimes the LEDs turns on and off rapidly.
  32. Generally speaking, the results seems to be quite random.
  33.  
  34. Could somebody tell what could be wrong either with my program, hardware, or 
  35. both?  Note:  My DS5000 is rated at 12 Mhtz, but I have it running at 8 Mhtz.
  36.  
  37.  
  38. ======  Program begins here ========
  39. .org 0
  40. anl h'087, #b'11111011 ;;;  Turn Watchdog off
  41.  
  42. setb P0.0       ;;  Turn LED on
  43. setb P0.1     ;;  P0.1 is now an INPUT
  44. sjmp loop
  45. RING:
  46.         ;;  clr P0.0; Turn LED on.
  47.    cpl P0.0     ;;  P0.0 = NOT P0.0  
  48.    ret
  49. NORING:
  50.         ;;  setb P0.0; Turn LED off.
  51.    cpl P0.0     ;;  P0.0 = NOT P0.0
  52.    ret
  53.  
  54. loop:
  55.    jnb P0.1,RING
  56.    jb P0.1,NORING
  57.    acall loop
  58. .end
  59.  
  60. ==== End program  ====
  61.  
  62. Thank you very much.
  63.  
  64. --
  65. pegasus@csd4.csd.uwm.edu
  66. -- 
  67. pegasus@csd4.csd.uwm.edu                David R. Hucke
  68.                                         UW-Milwaukee Film Major
  69. --
  70.