16f628 problem

Status
Not open for further replies.

zhaniko93

New Member
Code:
	list      p=16F628A            ; list directive to define processor
	#include <P16F628A.inc>        ; processor specific variable definitions



	__config _CP_OFF & _LVP_OFF & _WDT_OFF & _INTOSC_OSC_NOCLKOUT 
  clrw
   bsf STATUS, RP1
   movlw TRISA
    movlw TRISB

   bcf STATUS, RP1
   movlw 0xFF
  movwf PORTB
sas goto sas


	end
Can any1 tell me why doesn't it work? PORTB isn't set to 1 and TRISB and TRISA remain 0xFF (I saw it in PIC SIMULATOR IDE)
 
You can remove the clrw and replace the movlw TRISA and movlw TRISB with clrf TRISA and clrf TRISB
After a quick look at the datasheet, almost every pin on PORTB (except RB5) has a peripheral linked to it.


Edit: Wow what the hell, I hit enter to go to another line, not to submit the post. >_>
 
Last edited:
And why isn't PORTB set to 1 or even TRISB?
clrw
bsf STATUS, RP1
movlw TRISA
movlw TRISB

bcf STATUS, RP1
This Doesn't work! TRISB is left 0xFF after that!
 

hi,
Try this in the Sim.
You MUST turn OFF the comparators, CMCON
also you had selected BANK2 not BANK1

and its movwf not movlw...

Code:
   list      p=16F628A            ; list directive to define processor
    #include <P16F628A.inc>        ; processor specific variable definitions
    errorlevel  -302 , -207             ; suppress messages 302 [Bank] and 207 [label in column 1]

 

    __config _CP_OFF & _LVP_OFF & _WDT_OFF & _INTOSC_OSC_NOCLKOUT 


    org 0x0000

    movlw 007
    movwf CMCON




       bsf STATUS, RP0
    movlw 0x00
    movwf TRISA
       movwf TRISB
       bcf STATUS, RP0

       movlw 0xFF
      movwf PORTB

sas goto sas


    end
 
Last edited:
BANKSEL 1 and BANKSEL 0?

hi,
This image is from the MPLAB help files.

EDIT:
Use this line as part of the code header.

errorlevel -302 , -207 ; suppress messages 302 [Bank] and 207 [label in column 1]
 

Attachments

  • 000esp01.gif
    5.6 KB · Views: 204
Last edited:
list p=16F628A ; list directive to define processor
#include <P16F628A.inc> ; processor specific variable definitions[label in column 1]


Code:
    __config _CP_OFF & _LVP_OFF & _WDT_OFF & _INTOSC_OSC_NOCLKOUT 
[B]errorlevel  -302 , -207             ; suppress messages 302 [Bank] and 207 [label in column 1][/B]

    movlw 007
    movwf CMCON


  BANKSEL TRISA

    movlw 0x00
    movwf TRISA
       movwf TRISB
    BANKSEL PORTA
       movlw 0xFF
      movwf PORTB

sas goto sas

end
gives bank warnings why?
 
Last edited by a moderator:

hi,
I just answered that point...
 
Where did you have errors


Try this
Code:
 list p=16F628A ; list directive to define processor
 #include <P16F628A.inc> ; processor specific variable definitions[label in column 1]

 errorlevel  -302              ; suppress message 302 from list file

 __config _CP_OFF & _LVP_OFF & _WDT_OFF & _INTOSC_OSC_NOCLKOUT


	movlw 007
	movwf CMCON


	BANKSEL TRISA

	movlw 0x00
	movwf TRISA
	movwf TRISB
	BANKSEL PORTA
	movlw 0xFF
	movwf PORTB
sas: 
	goto sas

 end

You wasn't having real errors you just need to use the tab and set error level to 302

It's reminder message to tell you that a variable that is being accessed in not in bank 0.

But BANKSEL set's it right
 
Last edited:
I'm sorry I posted and look up where did all this come from LOL it wasn't showing your last 4 post

hi b80,
No problem, there are more bugs in this sites software than a Motel mattress....

Regards
 
Last edited:
HELLPP!! I've benn programming my pic16f628 I hav bought just today and after programming it twice on third time i Can't any more? When I put it in **broken link removed** programmer red light used to shine but doesn't shine any more and when I click on PROGRAMM IT button, green one shines but it doesn't write actualy, because when it starts verifying, it fails and When I press read code button, it reads FFFFFFFFF... all whats wrong? When I put it on breadboard, It does what it was programmed to do (flash led) and so it isn't corrupt yes? what can I do?
 
P.S. When i connect it to COM port (programer), red LED shines and then goes off imediatelly and Programmer works fine (it programms other micros well)
 
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…